@@ -73,7 +73,7 @@ private void CreateInterfaceIndexes(TypeInfo @interface, ICollection<TypeInfo> p
7373 var interfaceDef = context . ModelDef . Types [ @interface . UnderlyingType ] ;
7474
7575 // Build virtual declared interface index
76- foreach ( var indexDescriptor in interfaceDef . Indexes . Where ( i => ! i . IsPrimary ) ) {
76+ foreach ( var indexDescriptor in interfaceDef . Indexes . Where ( static i => ! i . IsPrimary ) ) {
7777 var index = BuildIndex ( @interface , indexDescriptor , false ) ;
7878
7979 @interface . Indexes . Add ( index ) ;
@@ -118,9 +118,9 @@ private void BuildInterfaceIndexes()
118118 }
119119 else {
120120 var interfaceDef = context . ModelDef . Types [ @interface . UnderlyingType ] ;
121- var indexDef = interfaceDef . Indexes . Single ( i => i . IsPrimary ) ;
121+ var indexDef = interfaceDef . Indexes . Single ( static i => i . IsPrimary ) ;
122122 var index = BuildIndex ( @interface , indexDef , false ) ;
123- var lookup = implementors . ToLookup ( t => t . Hierarchy ) ;
123+ var lookup = implementors . ToLookup ( static t => t . Hierarchy ) ;
124124 var underlyingIndexes = new List < IndexInfo > ( ) ;
125125 foreach ( var hierarchy in lookup ) {
126126 var underlyingIndex = BuildIndex ( @interface , indexDef , false ) ;
@@ -146,12 +146,12 @@ private void BuildInterfaceIndexes()
146146 if ( untypedIndexes . Contains ( typeIndex ) ) {
147147 if ( type == hierarchy . Key . Root ) {
148148 typeIndex = null ;
149- typedIndex = type . Indexes . Single ( i => i . IsPrimary && i . IsTyped ) ;
149+ typedIndex = type . Indexes . Single ( static i => i . IsPrimary && i . IsTyped ) ;
150150 }
151151 else {
152- typeIndex = type . Indexes . Single ( i => i . IsPrimary && ! i . IsVirtual ) ;
152+ typeIndex = type . Indexes . Single ( static i => i . IsPrimary && ! i . IsVirtual ) ;
153153 if ( typedIndex == null )
154- typedIndex = hierarchy . Key . Root . Indexes . Single ( i => i . IsPrimary && i . IsTyped ) ;
154+ typedIndex = hierarchy . Key . Root . Indexes . Single ( static i => i . IsPrimary && i . IsTyped ) ;
155155 }
156156 }
157157 if ( typeIndex != null )
@@ -194,7 +194,7 @@ private void BuildInterfaceIndexes()
194194 . Where ( t => t . Hierarchy == grouping . Key && ! t . IsAbstract )
195195 . ToList ( ) ;
196196 var primaryIndexes = allImplementors
197- . Select ( t => ( Index : t . Indexes . Single ( i => i . IsPrimary && ! i . IsVirtual ) , Type : t ) )
197+ . Select ( t => ( Index : t . Indexes . Single ( static i => i . IsPrimary && ! i . IsVirtual ) , Type : t ) )
198198 . Select ( p => untypedIndexes . Contains ( p . Index )
199199 ? p . Type . Indexes . Single ( i => i . IsPrimary && i . IsTyped )
200200 : p . Index )
@@ -216,9 +216,9 @@ private void BuildInterfaceIndexes()
216216 }
217217
218218 // Building secondary virtual indexes
219- foreach ( var interfaceIndex in @interface . Indexes . Where ( i => i . IsVirtual && ! i . IsPrimary ) ) {
219+ foreach ( var interfaceIndex in @interface . Indexes . Where ( static i => i . IsVirtual && ! i . IsPrimary ) ) {
220220 var localIndex = interfaceIndex ;
221- var lookup = implementors . ToLookup ( t => t . Hierarchy ) ;
221+ var lookup = implementors . ToLookup ( static t => t . Hierarchy ) ;
222222 var underlyingIndexes = new List < IndexInfo > ( ) ;
223223 foreach ( var hierarchy in lookup ) {
224224 var grouping = hierarchy ;
@@ -243,7 +243,8 @@ private void BuildInterfaceIndexes()
243243 break ;
244244 }
245245 case InheritanceSchema . SingleTable : {
246- var rootIndexes = hierarchy . Key . Root . Indexes . Where ( i => i . DeclaringIndex == localIndex . DeclaringIndex && implementors . Contains ( i . ReflectedType ) && ! i . IsVirtual ) ;
246+ var rootIndexes = hierarchy . Key . Root . Indexes
247+ . Where ( i => i . DeclaringIndex == localIndex . DeclaringIndex && implementors . Contains ( i . ReflectedType ) && ! i . IsVirtual ) ;
247248 foreach ( var rootIndex in rootIndexes ) {
248249 var index = untypedIndexes . Contains ( rootIndex )
249250 ? hierarchy . Key . Root . Indexes . Single ( i => i . DeclaringIndex == localIndex . DeclaringIndex && i . ReflectedType == rootIndex . ReflectedType && i . IsTyped )
@@ -310,7 +311,7 @@ private IndexInfo BuildIndex(TypeInfo typeInfo, IndexDef indexDef, bool buildAbs
310311 else if ( typeInfo . Hierarchy . TypeDiscriminatorMap != null )
311312 skipTypeId = true ;
312313 }
313- if ( typeInfo . Fields . Any ( f => f . IsTypeId && f . IsPrimaryKey ) )
314+ if ( typeInfo . Fields . Any ( static f => f . IsTypeId && f . IsPrimaryKey ) )
314315 skipTypeId = false ;
315316
316317 // Adding key columns
@@ -375,7 +376,7 @@ private IndexInfo BuildIndex(TypeInfo typeInfo, IndexDef indexDef, bool buildAbs
375376 }
376377 }
377378 else {
378- foreach ( var column in typeInfo . Columns . Where ( c => c . IsPrimaryKey ) ) {
379+ foreach ( var column in typeInfo . Columns . Where ( static c => c . IsPrimaryKey ) ) {
379380 if ( ! result . KeyColumns . ContainsKey ( column ) )
380381 result . ValueColumns . Add ( column ) ;
381382 }
@@ -414,7 +415,7 @@ private IndexInfo BuildInheritedIndex(TypeInfo reflectedType, IndexInfo ancestor
414415 else if ( reflectedType . Hierarchy . TypeDiscriminatorMap != null )
415416 skipTypeId = true ;
416417 }
417- if ( reflectedType . Fields . Any ( f => f . IsTypeId && f . IsPrimaryKey ) )
418+ if ( reflectedType . Fields . Any ( static f => f . IsTypeId && f . IsPrimaryKey ) )
418419 skipTypeId = false ;
419420
420421
@@ -512,12 +513,12 @@ private IndexInfo BuildTypedIndex(TypeInfo reflectedType, IndexInfo realIndex)
512513
513514 // Adding TypeId column
514515 if ( realIndex . IsPrimary )
515- result . ValueColumns . Add ( reflectedType . Columns . Single ( c => c . IsSystem && c . Field . IsTypeId ) ) ;
516+ result . ValueColumns . Add ( reflectedType . Columns . Single ( static c => c . IsSystem && c . Field . IsTypeId ) ) ;
516517 // Adding value columns
517518 result . ValueColumns . AddRange ( realIndex . ValueColumns ) ;
518519 // Adding TypeId column
519520 if ( ! realIndex . IsPrimary )
520- result . ValueColumns . Add ( reflectedType . Columns . Single ( c => c . IsSystem && c . Field . IsTypeId ) ) ;
521+ result . ValueColumns . Add ( reflectedType . Columns . Single ( static c => c . IsSystem && c . Field . IsTypeId ) ) ;
521522
522523 result . Name = nameBuilder . BuildIndexName ( reflectedType , result ) ;
523524 result . Group = BuildColumnGroup ( result ) ;
@@ -581,8 +582,8 @@ private IndexInfo BuildJoinIndex(TypeInfo reflectedType, IEnumerable<IndexInfo>
581582 // Adding value columns
582583 var typeOrder = reflectedType . Ancestors
583584 . Append ( reflectedType )
584- . Select ( ( t , i ) => ( Type : t , Index : i ) )
585- . ToDictionary ( a => a . Type , a => a . Index ) ;
585+ . Select ( static ( t , i ) => ( Type : t , Index : i ) )
586+ . ToDictionary ( static a => a . Type , static a => a . Index ) ;
586587 var types = reflectedType . Ancestors . ToHashSet ( ) ;
587588 types . Add ( reflectedType ) ;
588589
@@ -747,7 +748,7 @@ private IndexInfo BuildViewIndex(TypeInfo reflectedType, IndexInfo indexToApplyV
747748 columnMap . Add ( keyLength + i ) ;
748749 }
749750 var actualColumnMapping = valueColumns
750- . Zip ( columnMap , ( column , sourceIndex ) => ( column , sourceIndex ) )
751+ . Zip ( columnMap , static ( column , sourceIndex ) => ( column , sourceIndex ) )
751752 . OrderBy ( p => reflectedType . Columns . IndexOf ( p . column ) )
752753 . ToList ( ) ;
753754 valueColumns . Clear ( ) ;
@@ -809,11 +810,11 @@ private ColumnGroup BuildColumnGroup(IndexInfo index)
809810 var keyColumns = index . IsPrimary
810811 ? Enumerable . Range ( 0 , index . KeyColumns . Count ) . ToList ( index . KeyColumns . Count )
811812 : index . KeyColumns
812- . Select ( pair => pair . Key )
813+ . Select ( static pair => pair . Key )
813814 . Concat ( index . ValueColumns )
814- . Select ( ( c , i ) => ( c , i ) )
815- . Where ( arg => arg . c . IsPrimaryKey )
816- . Select ( arg => arg . i )
815+ . Select ( static ( c , i ) => ( c , i ) )
816+ . Where ( static arg => arg . c . IsPrimaryKey )
817+ . Select ( static arg => arg . i )
817818 . ToList ( ) ;
818819 var columns = Enumerable . Range ( 0 , index . KeyColumns . Count + index . ValueColumns . Count ) . ToList ( index . KeyColumns . Count + index . ValueColumns . Count ) ;
819820 return new ColumnGroup ( reflectedType , keyColumns , columns ) ;
@@ -822,9 +823,9 @@ private ColumnGroup BuildColumnGroup(IndexInfo index)
822823 private void CleanupTypedIndexes ( )
823824 {
824825
825- foreach ( var typeInfo in context . Model . Types . Where ( t => t . IsEntity ) ) {
826- var indexes = typeInfo . Indexes . Where ( i => i . IsVirtual ) . ToList ( ) ;
827- var typedIndexes = indexes . Where ( i => i . IsTyped ) ;
826+ foreach ( var typeInfo in context . Model . Types . Where ( static t => t . IsEntity ) ) {
827+ var indexes = typeInfo . Indexes . Where ( static i => i . IsVirtual ) . ToList ( ) ;
828+ var typedIndexes = indexes . Where ( static i => i . IsTyped ) ;
828829 foreach ( var typedIndex in typedIndexes ) {
829830 bool remove = false ;
830831 foreach ( var index in indexes )
@@ -895,7 +896,7 @@ private void ExtractAffectedIndexes(
895896 private static void BuildAffectedIndexesForMaterializedInterface ( TypeInfo typeInfo )
896897 {
897898 var primaryIndex = typeInfo . Indexes . PrimaryIndex ;
898- foreach ( var descendant in typeInfo . AllDescendants . Where ( t => t . IsEntity ) . Distinct ( ) ) {
899+ foreach ( var descendant in typeInfo . AllDescendants . Where ( static t => t . IsEntity ) . Distinct ( ) ) {
899900 descendant . AffectedIndexes . Add ( primaryIndex ) ;
900901 foreach ( var indexInfo in typeInfo . Indexes . Find ( IndexAttributes . Primary , MatchType . None ) . ToChainedBuffer ( ) ) {
901902 var descendantIndex = descendant . Indexes . Where ( i => i . DeclaringIndex == indexInfo . DeclaringIndex ) . FirstOrDefault ( ) ;
@@ -932,7 +933,7 @@ private static void ProcessAncestors(TypeInfo typeInfo, Action<TypeInfo> ancesto
932933
933934 private void BuildFiltersForPartialIndexes ( )
934935 {
935- foreach ( var index in context . Model . RealIndexes . Where ( index => index . FilterExpression != null ) ) {
936+ foreach ( var index in context . Model . RealIndexes . Where ( static index => index . FilterExpression != null ) ) {
936937 PartialIndexFilterBuilder . BuildFilter ( index ) ;
937938 }
938939 }
0 commit comments