Skip to content

Commit 7019aa0

Browse files
committed
Added obsolete warnings to methods that shouldn't have been made public in the first place. This'll make it easier to refactor away from them without too many ppeople complaining.
1 parent a101254 commit 7019aa0

16 files changed

+67
-5
lines changed

src/FluentNHibernate.Testing/FluentInterfaceTests/BaseModelFixture.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ protected ModelTester<CompositeElementPart<T>, CompositeElementMapping> Composit
142142

143143
protected ModelTester<StoredProcedurePart, StoredProcedureMapping> StoredProcedure()
144144
{
145+
#pragma warning disable 612,618
145146
return new ModelTester<StoredProcedurePart, StoredProcedureMapping>(() => new StoredProcedurePart(null, null), x => x.GetStoredProcedureMapping());
147+
#pragma warning restore 612,618
146148
}
147149

148150
protected ModelTester<NaturalIdPart<T>, NaturalIdMapping> NaturalId<T>()

src/FluentNHibernate/Automapping/AutoJoinPart.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace FluentNHibernate.Automapping
66
{
7+
#pragma warning disable 612,618,672
78
public class AutoJoinPart<T> : JoinPart<T>
89
{
910
readonly IList<Member> mappedMembers;
@@ -57,4 +58,5 @@ protected override AnyPart<TOther> ReferencesAny<TOther>(Member property)
5758
return base.ReferencesAny<TOther>(property);
5859
}
5960
}
61+
#pragma warning restore 612,618,672
6062
}

src/FluentNHibernate/Automapping/AutoJoinedSubClassPart.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace FluentNHibernate.Automapping
1111
{
12+
#pragma warning disable 612,618,672
1213
public class AutoJoinedSubClassPart<T> : JoinedSubClassPart<T>, IAutoClasslike
1314
{
1415
private readonly IList<Member> membersMapped = new List<Member>();
@@ -125,4 +126,5 @@ public IEnumerable<Member> GetIgnoredProperties()
125126
return membersMapped;
126127
}
127128
}
129+
#pragma warning restore 612,618,672
128130
}

src/FluentNHibernate/Automapping/AutoMapping.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace FluentNHibernate.Automapping
1212
{
13+
#pragma warning disable 612,618,672
1314
public class AutoMapping<T> : ClassMap<T>, IAutoClasslike, IPropertyIgnorer
1415
{
1516
readonly IList<Member> mappedMembers;
@@ -265,5 +266,6 @@ public override ImportPart ImportType<TImport>()
265266
return null;
266267
}
267268
#pragma warning restore 809
269+
#pragma warning restore 612,618,672
268270
}
269271
}

src/FluentNHibernate/Automapping/AutoSubClassPart.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace FluentNHibernate.Automapping
1111
{
12+
#pragma warning disable 612,618,672
1213
public class AutoSubClassPart<T> : SubClassPart<T>, IAutoClasslike
1314
{
1415
private readonly IList<Member> membersMapped = new List<Member>();
@@ -125,4 +126,5 @@ public IEnumerable<Member> GetIgnoredProperties()
125126
return membersMapped;
126127
}
127128
}
129+
#pragma warning restore 612,618,672
128130
}

src/FluentNHibernate/Mapping/ClassMap.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ public virtual IdentityPart Id(Expression<Func<T, object>> memberExpression)
9999
public virtual IdentityPart Id(Expression<Func<T, object>> memberExpression, string column)
100100
{
101101
var member = memberExpression.ToMember();
102+
#pragma warning disable 612,618
102103
var part = new IdentityPart(EntityType, member);
104+
#pragma warning restore 612,618
103105

104106
if (column != null)
105107
part.Column(column);
@@ -686,6 +688,7 @@ HibernateMapping IMappingProvider.GetHibernateMapping()
686688

687689
string GetDefaultTableName()
688690
{
691+
#pragma warning disable 612,618
689692
var tableName = EntityType.Name;
690693

691694
if (EntityType.IsGenericType)
@@ -699,6 +702,7 @@ string GetDefaultTableName()
699702
tableName += argument.Name;
700703
}
701704
}
705+
#pragma warning restore 612,618
702706

703707
return "`" + tableName + "`";
704708
}

src/FluentNHibernate/Mapping/ClasslikeMapBase.cs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ public PropertyPart Map(Expression<Func<T, object>> memberExpression)
4141
/// </example>
4242
public PropertyPart Map(Expression<Func<T, object>> memberExpression, string columnName)
4343
{
44+
#pragma warning disable 612,618
4445
return Map(memberExpression.ToMember(), columnName);
46+
#pragma warning restore 612,618
4547
}
4648

49+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
4750
protected virtual PropertyPart Map(Member property, string columnName)
4851
{
4952
var propertyMap = new PropertyPart(property, typeof(T));
@@ -82,7 +85,9 @@ public ManyToOnePart<TOther> References<TOther>(Expression<Func<T, TOther>> memb
8285
/// </example>
8386
public ManyToOnePart<TOther> References<TOther>(Expression<Func<T, TOther>> memberExpression, string columnName)
8487
{
88+
#pragma warning disable 612,618
8589
return References<TOther>(memberExpression.ToMember(), columnName);
90+
#pragma warning restore 612,618
8691
}
8792

8893
/// <summary>
@@ -111,9 +116,12 @@ public ManyToOnePart<TOther> References<TOther>(Expression<Func<T, object>> memb
111116
/// </example>
112117
public ManyToOnePart<TOther> References<TOther>(Expression<Func<T, object>> memberExpression, string columnName)
113118
{
119+
#pragma warning disable 612,618
114120
return References<TOther>(memberExpression.ToMember(), columnName);
121+
#pragma warning restore 612,618
115122
}
116123

124+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
117125
protected virtual ManyToOnePart<TOther> References<TOther>(Member property, string columnName)
118126
{
119127
var part = new ManyToOnePart<TOther>(EntityType, property);
@@ -133,9 +141,12 @@ protected virtual ManyToOnePart<TOther> References<TOther>(Member property, stri
133141
/// <param name="memberExpression">Property</param>
134142
public AnyPart<TOther> ReferencesAny<TOther>(Expression<Func<T, TOther>> memberExpression)
135143
{
144+
#pragma warning disable 612,618
136145
return ReferencesAny<TOther>(memberExpression.ToMember());
146+
#pragma warning restore 612,618
137147
}
138148

149+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
139150
protected virtual AnyPart<TOther> ReferencesAny<TOther>(Member property)
140151
{
141152
var part = new AnyPart<TOther>(typeof(T), property);
@@ -158,7 +169,9 @@ protected virtual AnyPart<TOther> ReferencesAny<TOther>(Member property)
158169
/// </example>
159170
public OneToOnePart<TOther> HasOne<TOther>(Expression<Func<T, Object>> memberExpression)
160171
{
172+
#pragma warning disable 612,618
161173
return HasOne<TOther>(memberExpression.ToMember());
174+
#pragma warning restore 612,618
162175
}
163176

164177
/// <summary>
@@ -174,9 +187,12 @@ public OneToOnePart<TOther> HasOne<TOther>(Expression<Func<T, Object>> memberExp
174187
/// </example>
175188
public OneToOnePart<TOther> HasOne<TOther>(Expression<Func<T, TOther>> memberExpression)
176189
{
190+
#pragma warning disable 612,618
177191
return HasOne<TOther>(memberExpression.ToMember());
192+
#pragma warning restore 612,618
178193
}
179194

195+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
180196
protected virtual OneToOnePart<TOther> HasOne<TOther>(Member property)
181197
{
182198
var part = new OneToOnePart<TOther>(EntityType, property);
@@ -200,9 +216,12 @@ protected virtual OneToOnePart<TOther> HasOne<TOther>(Member property)
200216
/// </example>
201217
public DynamicComponentPart<IDictionary> DynamicComponent(Expression<Func<T, IDictionary>> memberExpression, Action<DynamicComponentPart<IDictionary>> dynamicComponentAction)
202218
{
219+
#pragma warning disable 612,618
203220
return DynamicComponent(memberExpression.ToMember(), dynamicComponentAction);
221+
#pragma warning restore 612,618
204222
}
205223

224+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
206225
protected DynamicComponentPart<IDictionary> DynamicComponent(Member property, Action<DynamicComponentPart<IDictionary>> dynamicComponentAction)
207226
{
208227
var part = new DynamicComponentPart<IDictionary>(typeof(T), property);
@@ -246,7 +265,9 @@ public virtual ReferenceComponentPart<TComponent> Component<TComponent>(Expressi
246265
/// </example>
247266
public ComponentPart<TComponent> Component<TComponent>(Expression<Func<T, TComponent>> expression, Action<ComponentPart<TComponent>> action)
248267
{
268+
#pragma warning disable 612,618
249269
return Component(expression.ToMember(), action);
270+
#pragma warning restore 612,618
250271
}
251272

252273
/// <summary>
@@ -264,9 +285,12 @@ public ComponentPart<TComponent> Component<TComponent>(Expression<Func<T, TCompo
264285
/// </example>
265286
public ComponentPart<TComponent> Component<TComponent>(Expression<Func<T, object>> expression, Action<ComponentPart<TComponent>> action)
266287
{
288+
#pragma warning disable 612,618
267289
return Component(expression.ToMember(), action);
290+
#pragma warning restore 612,618
268291
}
269-
292+
293+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
270294
protected virtual ComponentPart<TComponent> Component<TComponent>(Member property, Action<ComponentPart<TComponent>> action)
271295
{
272296
var part = new ComponentPart<TComponent>(typeof(T), property);
@@ -293,9 +317,12 @@ public void Component(IComponentMappingProvider componentProvider)
293317

294318
private OneToManyPart<TChild> MapHasMany<TChild, TReturn>(Expression<Func<T, TReturn>> expression)
295319
{
320+
#pragma warning disable 612,618
296321
return HasMany<TChild>(expression.ToMember());
322+
#pragma warning restore 612,618
297323
}
298324

325+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
299326
protected virtual OneToManyPart<TChild> HasMany<TChild>(Member member)
300327
{
301328
var part = new OneToManyPart<TChild>(EntityType, member);
@@ -338,9 +365,12 @@ public OneToManyPart<TChild> HasMany<TChild>(Expression<Func<T, object>> memberE
338365

339366
private ManyToManyPart<TChild> MapHasManyToMany<TChild, TReturn>(Expression<Func<T, TReturn>> expression)
340367
{
368+
#pragma warning disable 612,618
341369
return HasManyToMany<TChild>(expression.ToMember());
370+
#pragma warning restore 612,618
342371
}
343372

373+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
344374
protected virtual ManyToManyPart<TChild> HasManyToMany<TChild>(Member property)
345375
{
346376
var part = new ManyToManyPart<TChild>(EntityType, property);
@@ -419,16 +449,19 @@ protected StoredProcedurePart StoredProcedure(string element, string innerText)
419449
return part;
420450
}
421451

452+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
422453
protected virtual IEnumerable<IPropertyMappingProvider> Properties
423454
{
424455
get { return properties; }
425456
}
426457

458+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
427459
protected virtual IEnumerable<IComponentMappingProvider> Components
428460
{
429461
get { return components; }
430462
}
431463

464+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
432465
public Type EntityType
433466
{
434467
get { return typeof(T); }

src/FluentNHibernate/Mapping/FilterDefinition.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public FilterDefinitionMapping GetFilterMapping()
5858
return mapping;
5959
}
6060

61+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
6162
public HibernateMapping GetHibernateMapping()
6263
{
6364
return new HibernateMapping();

src/FluentNHibernate/Mapping/FilterPart.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public string Name
3939
get { return filterName; }
4040
}
4141

42+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
4243
public void Write(XmlElement classElement, IMappingModelVisitor visitor)
4344
{
4445
XmlElement filterElement = classElement.AddElement("filter");

src/FluentNHibernate/Mapping/IndexManyToManyPart.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public IndexManyToManyPart EntityName(string entityName)
4545
return this;
4646
}
4747

48+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
4849
public IndexManyToManyMapping GetIndexMapping()
4950
{
5051
var mapping = new IndexManyToManyMapping(attributes.CloneInner());

src/FluentNHibernate/Mapping/IndexPart.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ public IndexPart Type<TIndex>()
3030
return this;
3131
}
3232

33-
public IndexPart Type(Type type)
34-
{
33+
public IndexPart Type(Type type)
34+
{
3535
attributes.Set(x => x.Type, new TypeReference(type));
3636
return this;
37-
}
37+
}
3838

39+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
3940
public IndexMapping GetIndexMapping()
4041
{
4142
var mapping = new IndexMapping(attributes.CloneInner());

src/FluentNHibernate/Mapping/ManyToManyPart.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,15 @@ protected override ICollectionMapping GetCollectionMapping()
358358

359359
// HACK: Index only on list and map - shouldn't have to do this!
360360
if (index != null && collection is IIndexedCollectionMapping)
361+
#pragma warning disable 612,618
361362
((IIndexedCollectionMapping)collection).Index = index.GetIndexMapping();
363+
#pragma warning restore 612,618
362364

363365
// HACK: shouldn't have to do this!
364366
if (manyToManyIndex != null && collection is MapMapping)
367+
#pragma warning disable 612,618
365368
((MapMapping)collection).Index = manyToManyIndex.GetIndexMapping();
369+
#pragma warning restore 612,618
366370

367371
return collection;
368372
}

src/FluentNHibernate/Mapping/OneToManyPart.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ protected override ICollectionMapping GetCollectionMapping()
192192

193193
// HACK: shouldn't have to do this!
194194
if (manyToManyIndex != null && collection is MapMapping)
195+
#pragma warning disable 612,618
195196
((MapMapping)collection).Index = manyToManyIndex.GetIndexMapping();
197+
#pragma warning restore 612,618
196198

197199
return collection;
198200
}

src/FluentNHibernate/Mapping/StoredProcedurePart.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using FluentNHibernate.Mapping.Providers;
23
using FluentNHibernate.MappingModel;
34

@@ -25,7 +26,7 @@ public CheckTypeExpression<StoredProcedurePart> Check
2526
get { return check; }
2627
}
2728

28-
29+
[Obsolete("Do not call this method. Implementation detail mistakenly made public. Will be made private in next version.")]
2930
public StoredProcedureMapping GetStoredProcedureMapping()
3031
{
3132
var mapping = new StoredProcedureMapping(attributes.CloneInner());

src/FluentNHibernate/Mapping/SubclassMap.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ void GenerateNestedSubclasses(SubclassMapping mapping)
331331

332332
string GetDefaultTableName()
333333
{
334+
#pragma warning disable 612,618
334335
var tableName = EntityType.Name;
335336

336337
if (EntityType.IsGenericType)
@@ -344,6 +345,7 @@ string GetDefaultTableName()
344345
tableName += argument.Name;
345346
}
346347
}
348+
#pragma warning restore 612,618
347349

348350
return "`" + tableName + "`";
349351
}

src/FluentNHibernate/Mapping/ToManyBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,9 @@ private void CreateIndexMapping(Action<IndexPart> customIndex)
356356
if (customIndex != null)
357357
customIndex(indexPart);
358358

359+
#pragma warning disable 612,618
359360
indexMapping = indexPart.GetIndexMapping();
361+
#pragma warning restore 612,618
360362
}
361363

362364
/// <summary>

0 commit comments

Comments
 (0)