Synchronization code

This commit is contained in:
sunkaixuan
2023-12-15 14:49:46 +08:00
parent 6ba3832943
commit 1df3647e96

View File

@@ -429,6 +429,21 @@ namespace SqlSugar
IndexFields.Add(fieldName10, sortType10); IndexFields.Add(fieldName10, sortType10);
this.IsUnique = isUnique; this.IsUnique = isUnique;
} }
public SugarIndexAttribute(string indexName, string[] fieldNames, OrderByType[] sortTypes, bool isUnique = false)
{
if (fieldNames.Length != sortTypes.Length)
{
Check.ExceptionEasy($"SugarIndexAttribute {indexName} fieldNames.Length!=sortTypes.Length 检查索引特性", $"SugarIndexAttribute {indexName} fieldNames.Length!=sortTypes.Length");
}
this.IndexName = indexName;
IndexFields = new Dictionary<string, OrderByType>();
for (int i = 0; i < fieldNames.Length; i++)
{
IndexFields.Add(fieldNames[i], sortTypes[i]);
}
this.IsUnique = isUnique;
}
} }
} }