1818using NHibernate . Proxy ;
1919using NHibernate . Util ;
2020using System . Collections . Generic ;
21+ using System . Runtime . Serialization ;
2122
2223namespace NHibernate . Type
2324{
@@ -98,9 +99,9 @@ public override async Task<object> ReplaceAsync(object original, object target,
9899 {
99100 return target ;
100101 }
101- if ( session . GetContextEntityIdentifier ( original ) == null && ( await ( ForeignKeys . IsTransientFastAsync ( associatedEntityName , original , session , cancellationToken ) ) . ConfigureAwait ( false ) ) . GetValueOrDefault ( ) )
102+ if ( session . GetContextEntityIdentifier ( original ) == null && ( await ( ForeignKeys . IsTransientFastAsync ( _associatedEntityName , original , session , cancellationToken ) ) . ConfigureAwait ( false ) ) . GetValueOrDefault ( ) )
102103 {
103- object copy = session . Factory . GetEntityPersister ( associatedEntityName ) . Instantiate ( null ) ;
104+ object copy = session . Factory . GetEntityPersister ( _associatedEntityName ) . Instantiate ( null ) ;
104105 //TODO: should this be Session.instantiate(Persister, ...)?
105106 copyCache . Add ( original , copy ) ;
106107 return copy ;
@@ -129,7 +130,7 @@ public override async Task<object> ReplaceAsync(object original, object target,
129130 /// <returns>
130131 /// An instance of the object or <see langword="null" /> if the identifer was null.
131132 /// </returns>
132- public override sealed async Task < object > NullSafeGetAsync ( DbDataReader rs , string [ ] names , ISessionImplementor session , object owner , CancellationToken cancellationToken )
133+ public sealed override async Task < object > NullSafeGetAsync ( DbDataReader rs , string [ ] names , ISessionImplementor session , object owner , CancellationToken cancellationToken )
133134 {
134135 cancellationToken . ThrowIfCancellationRequested ( ) ;
135136 return await ( ResolveIdentifierAsync ( await ( HydrateAsync ( rs , names , session , owner , cancellationToken ) ) . ConfigureAwait ( false ) , session , owner , cancellationToken ) ) . ConfigureAwait ( false ) ;
@@ -144,10 +145,10 @@ protected async Task<object> ResolveIdentifierAsync(object id, ISessionImplement
144145 {
145146 cancellationToken . ThrowIfCancellationRequested ( ) ;
146147 string entityName = GetAssociatedEntityName ( ) ;
147- bool isProxyUnwrapEnabled = unwrapProxy && session . Factory
148+ bool isProxyUnwrapEnabled = _unwrapProxy && session . Factory
148149 . GetEntityPersister ( entityName ) . IsInstrumented ;
149150
150- object proxyOrEntity = await ( session . InternalLoadAsync ( entityName , id , eager , IsNullable && ! isProxyUnwrapEnabled , cancellationToken ) ) . ConfigureAwait ( false ) ;
151+ object proxyOrEntity = await ( session . InternalLoadAsync ( entityName , id , _eager , IsNullable && ! isProxyUnwrapEnabled , cancellationToken ) ) . ConfigureAwait ( false ) ;
151152
152153 if ( proxyOrEntity . IsProxy ( ) )
153154 {
@@ -178,21 +179,19 @@ public override Task<object> ResolveIdentifierAsync(object value, ISessionImplem
178179 {
179180 return Task . FromResult < object > ( null ) ;
180181 }
181- else
182+
183+ if ( IsNull ( owner , session ) )
182184 {
183- if ( IsNull ( owner , session ) )
184- {
185- return Task . FromResult < object > ( null ) ; //EARLY EXIT!
186- }
185+ return Task . FromResult < object > ( null ) ; //EARLY EXIT!
186+ }
187187
188- if ( IsReferenceToPrimaryKey )
189- {
190- return ResolveIdentifierAsync ( value , session , cancellationToken ) ;
191- }
192- else
193- {
194- return LoadByUniqueKeyAsync ( GetAssociatedEntityName ( ) , _uniqueKeyPropertyName , value , session , cancellationToken ) ;
195- }
188+ if ( IsReferenceToPrimaryKey )
189+ {
190+ return ResolveIdentifierAsync ( value , session , cancellationToken ) ;
191+ }
192+ else
193+ {
194+ return LoadByUniqueKeyAsync ( GetAssociatedEntityName ( ) , _uniqueKeyPropertyName , value , session , cancellationToken ) ;
196195 }
197196 }
198197 catch ( Exception ex )
0 commit comments