@@ -56,7 +56,7 @@ internal sealed class EntitySetTask : IEquatable<EntitySetTask>
5656 private static readonly Parameter < int > itemCountLimitParameter = new Parameter < int > ( "ItemCountLimit" ) ;
5757
5858 private static readonly Func < ItemsQueryCacheKey , CompilableProvider > CreateRecordSetLoadingItems = cachingKey => {
59- var association = cachingKey . ReferencingField . Associations . Last ( ) ;
59+ var association = cachingKey . ReferencingField . Associations [ ^ 1 ] ;
6060 var primaryTargetIndex = association . TargetType . Indexes . PrimaryIndex ;
6161 var resultColumns = new List < int > ( primaryTargetIndex . Columns . Count ) ;
6262 var result = association . AuxiliaryType == null
@@ -104,7 +104,7 @@ public void UpdateCache()
104104 var reader = manager . Owner . Session . Domain . EntityDataReader ;
105105 var records = reader . Read ( itemsQueryTask . Result , QueryProvider . Header , manager . Owner . Session ) ;
106106 var entityKeys = new List < Key > ( itemsQueryTask . Result . Count ) ;
107- var association = ReferencingField . Associations . Last ( ) ;
107+ var association = ReferencingField . Associations [ ^ 1 ] ;
108108 var auxEntities = ( association . AuxiliaryType != null )
109109 ? new List < Pair < Key , Tuple > > ( itemsQueryTask . Result . Count )
110110 : null ;
@@ -191,7 +191,7 @@ private QueryTask CreateQueryTask()
191191
192192 private static CompilableProvider CreateQueryForAssociationViaAuxType ( in ItemsQueryCacheKey cachingKey , IndexInfo primaryTargetIndex , List < int > resultColumns )
193193 {
194- var association = cachingKey . ReferencingField . Associations . Last ( ) ;
194+ var association = cachingKey . ReferencingField . Associations [ ^ 1 ] ;
195195 var associationIndex = association . UnderlyingIndex ;
196196 var joiningColumns = GetJoiningColumnIndexes ( primaryTargetIndex , associationIndex ,
197197 association . AuxiliaryType != null ) ;
@@ -213,7 +213,7 @@ private static CompilableProvider CreateQueryForAssociationViaAuxType(in ItemsQu
213213 private static CompilableProvider CreateQueryForDirectAssociation ( in ItemsQueryCacheKey cachingKey , IndexInfo primaryTargetIndex , List < int > resultColumns )
214214 {
215215 AddResultColumnIndexes ( resultColumns , primaryTargetIndex , 0 ) ;
216- var association = cachingKey . ReferencingField . Associations . Last ( ) ;
216+ var association = cachingKey . ReferencingField . Associations [ ^ 1 ] ;
217217 var field = association . Reversed . OwnerField ;
218218 var keyColumnTypes = field . Columns . SelectToArray ( column => column . ValueType ) ;
219219 return primaryTargetIndex
0 commit comments