Skip to content

Commit e36542f

Browse files
committed
Optimize GetColumnsToBeLoaded()
1 parent e72e31e commit e36542f

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

Orm/Xtensive.Orm/Orm/Internals/Prefetch/PrefetchHelper.cs

+5-10
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,9 @@ public static bool AddColumns(IEnumerable<ColumnInfo> candidateColumns,
7575
return result;
7676
}
7777

78-
public static List<ColNum> GetColumnsToBeLoaded(SortedDictionary<ColNum, ColumnInfo> userColumnIndexes,
79-
TypeInfo type)
80-
{
81-
var result = new List<ColNum>(userColumnIndexes.Count);
82-
result.AddRange(type.Indexes.PrimaryIndex.ColumnIndexMap.System);
83-
result.AddRange(userColumnIndexes.Where(pair => !pair.Value.IsPrimaryKey
84-
&& !pair.Value.IsSystem).Select(pair => pair.Key));
85-
return result;
86-
}
78+
public static IReadOnlyList<ColNum> GetColumnsToBeLoaded(SortedDictionary<ColNum, ColumnInfo> userColumnIndexes, TypeInfo type) =>
79+
type.Indexes.PrimaryIndex.ColumnIndexMap.System
80+
.Concat(userColumnIndexes.Where(pair => !pair.Value.IsPrimaryKey && !pair.Value.IsSystem).Select(pair => pair.Key))
81+
.ToArray();
8782
}
88-
}
83+
}

0 commit comments

Comments
 (0)