Update core

This commit is contained in:
sunkaixuna
2021-11-21 14:20:17 +08:00
parent 00e59ea5c3
commit d17c862a26
4 changed files with 12 additions and 3 deletions

View File

@@ -39,8 +39,8 @@ namespace SqlSugar
public virtual async Task CreateTempAsync<T>(DataTable dt) where T : class, new()
{
await this.Context.UnionAll(
this.Context.Queryable<T>().Where(it => false).AS(dt.TableName),
this.Context.Queryable<T>().Where(it => false).AS(dt.TableName)).Select("top 1 * into #temp").ToListAsync();
this.Context.Queryable<T>().Select("*").Where(it => false).AS(dt.TableName),
this.Context.Queryable<T>().Select("*").Where(it => false).AS(dt.TableName)).Select("top 1 * into #temp").ToListAsync();
dt.TableName = "#temp";
}
}

View File

@@ -80,7 +80,7 @@ namespace SqlSugar
private async Task<int> _BulkUpdate(List<T> datas, string[] whereColumns, string[] updateColumns)
{
Begin(datas);
Check.Exception(whereColumns == null || whereColumns.Count() == 0, "where columns count=0");
Check.Exception(whereColumns == null || whereColumns.Count() == 0, "where columns count=0 or need primary key");
Check.Exception(updateColumns == null || updateColumns.Count() == 0, "set columns count=0");
var isAuto = this.context.CurrentConnectionConfig.IsAutoCloseConnection;
this.context.CurrentConnectionConfig.IsAutoCloseConnection = false;

View File

@@ -59,6 +59,14 @@ namespace SqlSugar
{
return Convert.ToInt64(value);
}
else if (type.IsIn(UtilConstants.IntType,UtilConstants.LongType,UtilConstants.ShortType))
{
return value;
}
else if (type==UtilConstants.GuidType)
{
return "'" + value.ToString() + "'";
}
else if (type == UtilConstants.ByteArrayType)
{
string bytesString = "0x" + BitConverter.ToString((byte[])value).Replace("-", "");

View File

@@ -44,6 +44,7 @@ namespace SqlSugar
{
this.Context.Ado.Connection.Open();
}
copy.BulkCopyTimeout = this.Context.Ado.CommandTimeOut;
return copy;
}