diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs index ae5da01e2..368a28e5b 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs @@ -70,18 +70,17 @@ namespace SqlSugar RestoreMapping(); return new KeyValuePair>(sql, InsertBuilder.Parameters); } - + public async Task> ExecuteReturnPkListAsync() + { + return await Task.Run(() => ExecuteReturnPkList()); + } public virtual List ExecuteReturnPkList() { 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(); - } - else if (isIdEntity&&this.InsertObjs.Length==1) + if (isIdEntity&&this.InsertObjs.Length==1) { return InsertPkListIdentityCount1(pkInfo); } @@ -93,6 +92,10 @@ namespace SqlSugar { return InsertPkListWithFunc(pkInfo); } + else if (pkInfo.UnderType == UtilConstants.LongType) + { + return InsertPkListLong(); + } else { return InsertPkListGuid(pkInfo); diff --git a/Src/Asp.NetCore2/SqlSugar/Interface/Insertable.cs b/Src/Asp.NetCore2/SqlSugar/Interface/Insertable.cs index c0d3f9d26..9cc7ca679 100644 --- a/Src/Asp.NetCore2/SqlSugar/Interface/Insertable.cs +++ b/Src/Asp.NetCore2/SqlSugar/Interface/Insertable.cs @@ -13,6 +13,7 @@ namespace SqlSugar int ExecuteCommand(); Task ExecuteCommandAsync(); List ExecuteReturnPkList(); + Task> ExecuteReturnPkListAsync(); long ExecuteReturnSnowflakeId(); List ExecuteReturnSnowflakeIdList(); Task ExecuteReturnSnowflakeIdAsync(); diff --git a/Src/Asp.NetCore2/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs b/Src/Asp.NetCore2/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs index e851fd2c9..940a51134 100644 --- a/Src/Asp.NetCore2/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs +++ b/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"; } }