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