mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- update SetTablePrimary isIdentity only First #1529
This commit is contained in:
parent
6caf74252a
commit
7ec4279ba1
@ -1109,14 +1109,18 @@ SELECT ");
|
||||
|
||||
public static void SetTablePrimary(TableInfo table, bool isIdenity, params string[] primarys)
|
||||
{
|
||||
var isFirst = true;
|
||||
foreach (var primary in primarys)
|
||||
{
|
||||
if (table.ColumnsByCs.TryGetValue(string.Concat(primary), out var col))
|
||||
{
|
||||
col.Attribute.IsPrimary = true;
|
||||
if (isIdenity)
|
||||
if (isFirst && isIdenity)
|
||||
{
|
||||
isFirst = false;
|
||||
col.Attribute.IsIdentity = true;
|
||||
}
|
||||
}
|
||||
else throw new Exception(CoreStrings.GetPrimarys_ParameterError_IsNotDictKey(primary));
|
||||
}
|
||||
table.Primarys = table.Columns.Where(a => a.Value.Attribute.IsPrimary).Select(a => a.Value).ToArray();
|
||||
|
Loading…
x
Reference in New Issue
Block a user