Browse Source

Synchronization code

pull/25/head
sunkaixuan 2 years ago
parent
commit
f03db95cbf
  1. 15
      Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs
  2. 1
      Src/Asp.NetCore2/SqlSugar/Interface/Insertable.cs
  3. 2
      Src/Asp.NetCore2/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs

15
Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs

@ -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);

1
Src/Asp.NetCore2/SqlSugar/Interface/Insertable.cs

@ -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();

2
Src/Asp.NetCore2/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs

@ -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";
}
}

Loading…
Cancel
Save