Skip to content

Commit d7605f0

Browse files
committed
GetIndex()
1 parent 0b960c1 commit d7605f0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Orm/Xtensive.Orm/Orm/Model/TypeIndexInfoCollection.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ public IndexInfo FindFirst(IndexAttributes indexAttributes) =>
4848
Find(indexAttributes).FirstOrDefault();
4949

5050
[DebuggerStepThrough]
51-
public IndexInfo GetIndex(string fieldName, params string[] fieldNames)
51+
public IndexInfo GetIndex(string fieldName, params ReadOnlySpan<string> fieldNames)
5252
{
53-
var names = (fieldNames ?? Array.Empty<string>()).Prepend(fieldName);
54-
5553
var fields = new List<FieldInfo>();
5654
var reflectedTypeFields = primaryIndex.ReflectedType.Fields;
57-
foreach (var name in names) {
58-
if (reflectedTypeFields.TryGetValue(name, out var field)) {
55+
if (reflectedTypeFields.TryGetValue(fieldName, out var field)) {
56+
fields.Add(field);
57+
}
58+
foreach (var name in fieldNames) {
59+
if (reflectedTypeFields.TryGetValue(name, out field)) {
5960
fields.Add(field);
6061
}
6162
}

0 commit comments

Comments
 (0)