Synchronization code

This commit is contained in:
sunkaixuan 2023-03-30 18:57:07 +08:00
parent fd2fd01af4
commit e954da03cc
4 changed files with 20 additions and 0 deletions

View File

@ -1044,6 +1044,13 @@ namespace SqlSugar
return Tuple.Create<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>, List<T7>>(result, result2, result3, result4, result5, result6, result7);
}
}
public Task<List<T>> SqlQueryAsync<T>(string sql, object parameters, CancellationToken token)
{
this.CancellationToken = token;
return SqlQueryAsync<T>(sql, parameters);
}
public virtual Task<List<T>> SqlQueryAsync<T>(string sql, object parameters = null)
{
var sugarParameters = this.GetParameters(parameters);
@ -1350,6 +1357,11 @@ namespace SqlSugar
return ExecuteCommand(sql, parameters.ToArray());
}
}
public Task<int> ExecuteCommandAsync(string sql, object parameters, CancellationToken cancellationToken)
{
this.CancellationToken = CancellationToken;
return ExecuteCommandAsync(sql,parameters);
}
public virtual Task<int> ExecuteCommandAsync(string sql, object parameters)
{
return ExecuteCommandAsync(sql, GetParameters(parameters));

View File

@ -146,6 +146,11 @@ namespace SqlSugar
After(sql);
return result;
}
public Task<bool> ExecuteCommandHasChangeAsync(CancellationToken token)
{
this.Context.Ado.CancellationToken= token;
return ExecuteCommandHasChangeAsync();
}
public async Task<bool> ExecuteCommandHasChangeAsync()
{

View File

@ -78,6 +78,7 @@ namespace SqlSugar
Task<int> ExecuteCommandAsync(string sql, params SugarParameter[] parameters);
Task<int> ExecuteCommandAsync(string sql, object parameters);
Task<int> ExecuteCommandAsync(string sql, object parameters,CancellationToken cancellationToken);
Task<int> ExecuteCommandAsync(string sql, List<SugarParameter> parameters);
string GetString(string sql, object parameters);
@ -151,6 +152,7 @@ namespace SqlSugar
List<T> MasterSqlQuery<T>(string sql, object parameters = null);
Task<List<T>> SqlQueryAsync<T>(string sql, object parameters = null);
Task<List<T>> SqlQueryAsync<T>(string sql, object parameters = null,CancellationToken token);
Task<List<T>> SqlQueryAsync<T>(string sql, List<SugarParameter> parameters);
Task<List<T>> SqlQueryAsync<T>(string sql, params SugarParameter[] parameters);

View File

@ -21,6 +21,7 @@ namespace SqlSugar
Task<int> ExecuteCommandAsync();
Task<int> ExecuteCommandAsync(CancellationToken token);
Task<bool> ExecuteCommandHasChangeAsync();
Task<bool> ExecuteCommandHasChangeAsync(CancellationToken token);
IUpdateable<T> AS(string tableName);