@@ -17,7 +17,11 @@ namespace NHibernate.Type
17
17
[ Serializable ]
18
18
public abstract partial class EntityType : AbstractType , IAssociationType
19
19
{
20
+ // Since v5.1
21
+ [ Obsolete ( "This field has no more usages in NHibernate and will be removed. Use RHSUniqueKeyPropertyName instead." ) ]
20
22
protected readonly string uniqueKeyPropertyName ;
23
+
24
+ private readonly string _uniqueKeyPropertyName ;
21
25
private readonly bool eager ;
22
26
private readonly string associatedEntityName ;
23
27
private readonly bool unwrapProxy ;
@@ -37,8 +41,12 @@ public abstract partial class EntityType : AbstractType, IAssociationType
37
41
/// </param>
38
42
protected internal EntityType ( string entityName , string uniqueKeyPropertyName , bool eager , bool unwrapProxy )
39
43
{
40
- associatedEntityName = entityName ;
44
+ #pragma warning disable 618
41
45
this . uniqueKeyPropertyName = uniqueKeyPropertyName ;
46
+ #pragma warning restore 618
47
+
48
+ associatedEntityName = entityName ;
49
+ _uniqueKeyPropertyName = uniqueKeyPropertyName ;
42
50
this . eager = eager ;
43
51
this . unwrapProxy = unwrapProxy ;
44
52
}
@@ -165,12 +173,12 @@ protected internal object GetReferenceValue(object value, ISessionImplementor se
165
173
else
166
174
{
167
175
IEntityPersister entityPersister = session . Factory . GetEntityPersister ( GetAssociatedEntityName ( ) ) ;
168
- object propertyValue = entityPersister . GetPropertyValue ( value , uniqueKeyPropertyName ) ;
176
+ object propertyValue = entityPersister . GetPropertyValue ( value , _uniqueKeyPropertyName ) ;
169
177
170
178
// We now have the value of the property-ref we reference. However,
171
179
// we need to dig a little deeper, as that property might also be
172
180
// an entity type, in which case we need to resolve its identitifier
173
- IType type = entityPersister . GetPropertyType ( uniqueKeyPropertyName ) ;
181
+ IType type = entityPersister . GetPropertyType ( _uniqueKeyPropertyName ) ;
174
182
if ( type . IsEntityType )
175
183
{
176
184
propertyValue = ( ( EntityType ) type ) . GetReferenceValue ( propertyValue , session ) ;
@@ -283,7 +291,7 @@ public override sealed object NullSafeGet(DbDataReader rs, string[] names, ISess
283
291
284
292
public bool IsUniqueKeyReference
285
293
{
286
- get { return uniqueKeyPropertyName != null ; }
294
+ get { return _uniqueKeyPropertyName != null ; }
287
295
}
288
296
289
297
public abstract bool IsNullable { get ; }
@@ -311,7 +319,7 @@ public IType GetIdentifierOrUniqueKeyType(IMapping factory)
311
319
}
312
320
else
313
321
{
314
- IType type = factory . GetReferencedPropertyType ( GetAssociatedEntityName ( ) , uniqueKeyPropertyName ) ;
322
+ IType type = factory . GetReferencedPropertyType ( GetAssociatedEntityName ( ) , _uniqueKeyPropertyName ) ;
315
323
if ( type . IsEntityType )
316
324
{
317
325
type = ( ( EntityType ) type ) . GetIdentifierOrUniqueKeyType ( factory ) ;
@@ -333,7 +341,7 @@ public string GetIdentifierOrUniqueKeyPropertyName(IMapping factory)
333
341
}
334
342
else
335
343
{
336
- return uniqueKeyPropertyName ;
344
+ return _uniqueKeyPropertyName ;
337
345
}
338
346
}
339
347
@@ -399,7 +407,7 @@ public override object ResolveIdentifier(object value, ISessionImplementor sessi
399
407
}
400
408
else
401
409
{
402
- return LoadByUniqueKey ( GetAssociatedEntityName ( ) , uniqueKeyPropertyName , value , session ) ;
410
+ return LoadByUniqueKey ( GetAssociatedEntityName ( ) , _uniqueKeyPropertyName , value , session ) ;
403
411
}
404
412
}
405
413
}
@@ -438,7 +446,7 @@ public string LHSPropertyName
438
446
439
447
public string RHSUniqueKeyPropertyName
440
448
{
441
- get { return uniqueKeyPropertyName ; }
449
+ get { return _uniqueKeyPropertyName ; }
442
450
}
443
451
444
452
public virtual string PropertyName
@@ -472,7 +480,7 @@ public override int GetHashCode(object x, ISessionFactoryImplementor factory)
472
480
473
481
public bool IsReferenceToPrimaryKey
474
482
{
475
- get { return string . IsNullOrEmpty ( uniqueKeyPropertyName ) ; }
483
+ get { return string . IsNullOrEmpty ( _uniqueKeyPropertyName ) ; }
476
484
}
477
485
478
486
public string GetOnCondition ( string alias , ISessionFactoryImplementor factory , IDictionary < string , IFilter > enabledFilters )
0 commit comments