@@ -652,7 +652,35 @@ private async Task<object[]> GetRowAsync(DbDataReader rs, ILoadable[] persisters
652
652
// been cached too for all its unique keys, provided its persister implement it. With this new
653
653
// way of caching unique keys, it is no more needed to handle caching for alreadyLoaded path
654
654
// too.
655
- await ( ( persister as IUniqueKeyLoadable ) . CacheByUniqueKeysAsync ( obj , session , cancellationToken ) ) . ConfigureAwait ( false ) ;
655
+ var cacheByUniqueKeysTask = ( persister as IUniqueKeyLoadable ) ? . CacheByUniqueKeysAsync ( obj , session , cancellationToken ) ;
656
+
657
+ // IUniqueKeyLoadable.CacheByUniqueKeys caches all unique keys of the entity, regardless of
658
+ // associations loaded by the query. So if the entity is already loaded, it has forcibly already
659
+ // been cached too for all its unique keys, provided its persister implement it. With this new
660
+ // way of caching unique keys, it is no more needed to handle caching for alreadyLoaded path
661
+ // too.
662
+ if ( cacheByUniqueKeysTask != null )
663
+
664
+ // IUniqueKeyLoadable.CacheByUniqueKeys caches all unique keys of the entity, regardless of
665
+ // associations loaded by the query. So if the entity is already loaded, it has forcibly already
666
+ // been cached too for all its unique keys, provided its persister implement it. With this new
667
+ // way of caching unique keys, it is no more needed to handle caching for alreadyLoaded path
668
+ // too.
669
+ {
670
+
671
+ // IUniqueKeyLoadable.CacheByUniqueKeys caches all unique keys of the entity, regardless of
672
+ // associations loaded by the query. So if the entity is already loaded, it has forcibly already
673
+ // been cached too for all its unique keys, provided its persister implement it. With this new
674
+ // way of caching unique keys, it is no more needed to handle caching for alreadyLoaded path
675
+ // too.
676
+ await ( cacheByUniqueKeysTask ) . ConfigureAwait ( false ) ;
677
+
678
+ // IUniqueKeyLoadable.CacheByUniqueKeys caches all unique keys of the entity, regardless of
679
+ // associations loaded by the query. So if the entity is already loaded, it has forcibly already
680
+ // been cached too for all its unique keys, provided its persister implement it. With this new
681
+ // way of caching unique keys, it is no more needed to handle caching for alreadyLoaded path
682
+ // too.
683
+ }
656
684
}
657
685
// 6.0 TODO: this call is nor more needed for up-to-date persisters, remove once CacheByUniqueKeys
658
686
// is merged in IUniqueKeyLoadable interface instead of being an extension method
0 commit comments