Browse Source

Update .net framework

pull/19/head
sunkaixuan 3 years ago
parent
commit
4b2c2263a2
  1. 11
      Src/Asp.Net/SqlSugar/Abstract/FastestProvider/FastestProvider.cs
  2. 12
      Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs
  3. 2
      Src/Asp.Net/SqlSugar/Interface/IFastest.cs
  4. 3
      Src/Asp.Net/SqlSugar/Utilities/UtilConstants.cs

11
Src/Asp.Net/SqlSugar/Abstract/FastestProvider/FastestProvider.cs

@ -29,6 +29,11 @@ namespace SqlSugar
Check.ExceptionEasy(this.AsName.IsNullOrEmpty(), "need .AS(tablaeName) ", "需要 .AS(tablaeName) 设置表名"); Check.ExceptionEasy(this.AsName.IsNullOrEmpty(), "need .AS(tablaeName) ", "需要 .AS(tablaeName) 设置表名");
return BulkCopyAsync(this.AsName, dt).ConfigureAwait(true).GetAwaiter().GetResult(); return BulkCopyAsync(this.AsName, dt).ConfigureAwait(true).GetAwaiter().GetResult();
} }
public Task<int> BulkCopyAsync(DataTable dt)
{
Check.ExceptionEasy(this.AsName.IsNullOrEmpty(), "need .AS(tablaeName) ", "需要 .AS(tablaeName) 设置表名");
return BulkCopyAsync(this.AsName, dt);
}
public async Task<int> BulkCopyAsync(string tableName, DataTable dt) public async Task<int> BulkCopyAsync(string tableName, DataTable dt)
{ {
if (Size > 0) if (Size > 0)
@ -115,6 +120,12 @@ namespace SqlSugar
Check.ExceptionEasy(this.AsName.IsNullOrEmpty(), "need .AS(tablaeName) ", "需要 .AS(tablaeName) 设置表名"); Check.ExceptionEasy(this.AsName.IsNullOrEmpty(), "need .AS(tablaeName) ", "需要 .AS(tablaeName) 设置表名");
return BulkUpdateAsync(this.AsName, dataTable, whereColumns, updateColumns).ConfigureAwait(true).GetAwaiter().GetResult(); return BulkUpdateAsync(this.AsName, dataTable, whereColumns, updateColumns).ConfigureAwait(true).GetAwaiter().GetResult();
} }
public Task<int> BulkUpdateAsync(DataTable dataTable, string[] whereColumns)
{
string[] updateColumns = dataTable.Columns.Cast<DataColumn>().Select(it => it.ColumnName).Where(it => !whereColumns.Any(z => z.EqualCase(it))).ToArray();
Check.ExceptionEasy(this.AsName.IsNullOrEmpty(), "need .AS(tablaeName) ", "需要 .AS(tablaeName) 设置表名");
return BulkUpdateAsync(this.AsName, dataTable, whereColumns, updateColumns);
}
public async Task<int> BulkUpdateAsync(string tableName, DataTable dataTable, string[] whereColumns, string[] updateColumns) public async Task<int> BulkUpdateAsync(string tableName, DataTable dataTable, string[] whereColumns, string[] updateColumns)
{ {

12
Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs

@ -138,6 +138,18 @@ namespace SqlSugar
this.DbType = System.Data.DbType.Int64; this.DbType = System.Data.DbType.Int64;
this.Value = Convert.ToInt64(Value); this.Value = Convert.ToInt64(Value);
} }
else if (type==UtilConstants.UIntType)
{
this.DbType = System.Data.DbType.UInt32;
}
else if (type == UtilConstants.ULongType)
{
this.DbType = System.Data.DbType.UInt64;
}
else if (type == UtilConstants.ShortType)
{
this.DbType = System.Data.DbType.UInt16;
}
} }
public SugarParameter(string name, object value, bool isOutput) public SugarParameter(string name, object value, bool isOutput)

2
Src/Asp.Net/SqlSugar/Interface/IFastest.cs

@ -18,6 +18,7 @@ namespace SqlSugar
int BulkCopy(string tableName,DataTable dataTable); int BulkCopy(string tableName,DataTable dataTable);
int BulkCopy(DataTable dataTable); int BulkCopy(DataTable dataTable);
Task<int> BulkCopyAsync(string tableName, DataTable dataTable); Task<int> BulkCopyAsync(string tableName, DataTable dataTable);
Task<int> BulkCopyAsync(DataTable dataTable);
int BulkUpdate(List<T> datas); int BulkUpdate(List<T> datas);
Task<int> BulkUpdateAsync(List<T> datas); Task<int> BulkUpdateAsync(List<T> datas);
@ -27,6 +28,7 @@ namespace SqlSugar
int BulkUpdate(DataTable dataTable, string[] whereColumns, string[] updateColumns); int BulkUpdate(DataTable dataTable, string[] whereColumns, string[] updateColumns);
int BulkUpdate(DataTable dataTable, string[] whereColumns); int BulkUpdate(DataTable dataTable, string[] whereColumns);
Task<int> BulkUpdateAsync(string tableName, DataTable dataTable, string[] whereColumns, string[] updateColumns); Task<int> BulkUpdateAsync(string tableName, DataTable dataTable, string[] whereColumns, string[] updateColumns);
Task<int> BulkUpdateAsync(DataTable dataTable, string[] whereColumns);
SplitFastest<T> SplitTable(); SplitFastest<T> SplitTable();
} }
} }

3
Src/Asp.Net/SqlSugar/Utilities/UtilConstants.cs

@ -15,6 +15,9 @@ namespace SqlSugar
internal const string ReplaceKey = "{662E689B-17A1-4D06-9D27-F29EAB8BC3D6}"; internal const string ReplaceKey = "{662E689B-17A1-4D06-9D27-F29EAB8BC3D6}";
internal const string ReplaceCommaKey = "{112A689B-17A1-4A06-9D27-A39EAB8BC3D5}"; internal const string ReplaceCommaKey = "{112A689B-17A1-4A06-9D27-A39EAB8BC3D5}";
internal static Type UShortType = typeof(ushort);
internal static Type ULongType = typeof(ulong);
internal static Type UIntType = typeof(uint);
internal static Type IntType = typeof(int); internal static Type IntType = typeof(int);
internal static Type LongType = typeof(long); internal static Type LongType = typeof(long);
internal static Type GuidType = typeof(Guid); internal static Type GuidType = typeof(Guid);

Loading…
Cancel
Save