Synchronization code

This commit is contained in:
sunkaixuan
2022-11-03 09:47:13 +08:00
parent 67eb66e533
commit f03db95cbf
3 changed files with 11 additions and 7 deletions

View File

@@ -70,18 +70,17 @@ namespace SqlSugar
RestoreMapping();
return new KeyValuePair<string, List<SugarParameter>>(sql, InsertBuilder.Parameters);
}
public async Task<List<Type>> ExecuteReturnPkListAsync<Type>()
{
return await Task.Run(() => ExecuteReturnPkList<Type>());
}
public virtual List<Type> ExecuteReturnPkList<Type>()
{
var pkInfo= this.EntityInfo.Columns.FirstOrDefault(it => it.IsPrimarykey == true);
Check.ExceptionEasy(pkInfo==null,"ExecuteReturnPkList need primary key", "ExecuteReturnPkList需要主键");
Check.ExceptionEasy(this.EntityInfo.Columns.Count(it => it.IsPrimarykey == true)>1, "ExecuteReturnPkList Only support technology single primary key", "ExecuteReturnPkList只支技单主键");
var isIdEntity = pkInfo.IsIdentity|| (pkInfo.OracleSequenceName.HasValue()&&this.Context.CurrentConnectionConfig.DbType==DbType.Oracle);
if (pkInfo.UnderType == UtilConstants.LongType)
{
return InsertPkListLong<Type>();
}
else if (isIdEntity&&this.InsertObjs.Length==1)
if (isIdEntity&&this.InsertObjs.Length==1)
{
return InsertPkListIdentityCount1<Type>(pkInfo);
}
@@ -93,6 +92,10 @@ namespace SqlSugar
{
return InsertPkListWithFunc<Type>(pkInfo);
}
else if (pkInfo.UnderType == UtilConstants.LongType)
{
return InsertPkListLong<Type>();
}
else
{
return InsertPkListGuid<Type>(pkInfo);

View File

@@ -13,6 +13,7 @@ namespace SqlSugar
int ExecuteCommand();
Task<int> ExecuteCommandAsync();
List<Type> ExecuteReturnPkList<Type>();
Task<List<Type>> ExecuteReturnPkListAsync<Type>();
long ExecuteReturnSnowflakeId();
List<long> ExecuteReturnSnowflakeIdList();
Task<long> ExecuteReturnSnowflakeIdAsync();

View File

@@ -214,7 +214,7 @@ namespace SqlSugar
{
get
{
return "EXECUTE sp_addextendedproperty N'MS_Description', '{1}', N'user', N'dbo', N'table', N'{0}', NULL, NULL";
return "EXECUTE sp_addextendedproperty N'MS_Description', N'{1}', N'user', N'dbo', N'table', N'{0}', NULL, NULL";
}
}