mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-03 20:27:56 +08:00
Synchronization code
This commit is contained in:
parent
6d0fe85cd0
commit
14e132c5fb
@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlSugar
|
||||
@ -150,6 +151,11 @@ namespace SqlSugar
|
||||
result += updateRow;
|
||||
return result;
|
||||
}
|
||||
public Task<int> ExecuteCommandAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
this.Context.Ado.CancellationToken=cancellationToken;
|
||||
return ExecuteCommandAsync();
|
||||
}
|
||||
public async Task<int> ExecuteCommandAsync()
|
||||
{
|
||||
var result = 0;
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlSugar
|
||||
@ -56,8 +57,10 @@ namespace SqlSugar
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public async Task<int> ExecuteCommandAsync()
|
||||
public async Task<int> ExecuteCommandAsync(CancellationToken? cancellationToken=null)
|
||||
{
|
||||
if (cancellationToken != null)
|
||||
this.Context.Ado.CancellationToken = cancellationToken.Value;
|
||||
if (Data.Count() == 1 && Data.First() == null)
|
||||
{
|
||||
return 0;
|
||||
@ -121,8 +124,10 @@ namespace SqlSugar
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public async Task<int> ExecuteSqlBulkCopyAsync()
|
||||
public async Task<int> ExecuteSqlBulkCopyAsync(CancellationToken? cancellationToken = null)
|
||||
{
|
||||
if(cancellationToken!=null)
|
||||
this.Context.Ado.CancellationToken = cancellationToken.Value;
|
||||
if (Data.Count() == 1 && Data.First() == null)
|
||||
{
|
||||
return 0;
|
||||
|
@ -1006,6 +1006,10 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Saveable
|
||||
public IStorageable<T> Storageable<T>(T[] dataList) where T : class, new()
|
||||
{
|
||||
return Storageable(dataList?.ToList());
|
||||
}
|
||||
public ISaveable<T> Saveable<T>(List<T> saveObjects) where T : class, new()
|
||||
{
|
||||
return new SaveableProvider<T>(this, saveObjects);
|
||||
|
@ -602,6 +602,10 @@ namespace SqlSugar
|
||||
{
|
||||
return ScopedContext.SqlQueryable<T>(sql);
|
||||
}
|
||||
public IStorageable<T> Storageable<T>(T[] dataList) where T : class, new()
|
||||
{
|
||||
return ScopedContext.Storageable(dataList);
|
||||
}
|
||||
public StorageableDataTable Storageable(List<Dictionary<string, object>> dictionaryList, string tableName)
|
||||
{
|
||||
return ScopedContext.Storageable(dictionaryList, tableName);
|
||||
|
@ -146,6 +146,7 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Saveable
|
||||
IStorageable<T> Storageable<T>(T[] dataList) where T : class, new();
|
||||
StorageableDataTable Storageable(List<Dictionary<string, object>> dictionaryList, string tableName);
|
||||
StorageableDataTable Storageable(Dictionary<string, object> dictionary, string tableName);
|
||||
IStorageable<T> Storageable<T>(List<T> dataList) where T : class, new();
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
namespace SqlSugar
|
||||
{
|
||||
@ -29,6 +30,7 @@ namespace SqlSugar
|
||||
IStorageable<T> As(string tableName);
|
||||
int ExecuteCommand();
|
||||
Task<int> ExecuteCommandAsync();
|
||||
Task<int> ExecuteCommandAsync(CancellationToken cancellationToken);
|
||||
int ExecuteSqlBulkCopy();
|
||||
Task<int> ExecuteSqlBulkCopyAsync();
|
||||
IStorageable<T> DefaultAddElseUpdate();
|
||||
|
@ -556,6 +556,10 @@ namespace SqlSugar
|
||||
{
|
||||
return this.Context.Storageable(dataList);
|
||||
}
|
||||
public IStorageable<T> Storageable<T>(T[] dataList) where T : class, new()
|
||||
{
|
||||
return this.Context.Storageable(dataList?.ToList());
|
||||
}
|
||||
public IStorageable<T> Storageable<T>(T data) where T : class, new()
|
||||
{
|
||||
Check.Exception(typeof(T).FullName.Contains("System.Collections.Generic.List`"), " need where T: class, new() ");
|
||||
|
Loading…
Reference in New Issue
Block a user