mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
ExecuteCommandHasChange
This commit is contained in:
parent
ce1431b803
commit
5cd2e7cec9
@ -30,6 +30,10 @@ namespace SqlSugar
|
||||
RestoreMapping();
|
||||
return Db.ExecuteCommand(sql, paramters);
|
||||
}
|
||||
public bool ExecuteCommandHasChange()
|
||||
{
|
||||
return ExecuteCommand() > 0;
|
||||
}
|
||||
public Task<int> ExecuteCommandAsync()
|
||||
{
|
||||
Task<int> result = new Task<int>(() =>
|
||||
@ -40,6 +44,16 @@ namespace SqlSugar
|
||||
result.Start();
|
||||
return result;
|
||||
}
|
||||
public Task<bool> ExecuteCommandHasChangeAsync()
|
||||
{
|
||||
Task<bool> result = new Task<bool>(() =>
|
||||
{
|
||||
IDeleteable<T> asyncDeleteable = CopyDeleteable();
|
||||
return asyncDeleteable.ExecuteCommand()>0;
|
||||
});
|
||||
result.Start();
|
||||
return result;
|
||||
}
|
||||
public IDeleteable<T> AS(string tableName)
|
||||
{
|
||||
var entityName = typeof(T).Name;
|
||||
@ -188,7 +202,7 @@ namespace SqlSugar
|
||||
{
|
||||
if (DeleteBuilder.BigDataInValues == null)
|
||||
DeleteBuilder.BigDataInValues = new List<object>();
|
||||
DeleteBuilder.BigDataInValues.AddRange(primaryKeyValues.Select(it=>(object)it));
|
||||
DeleteBuilder.BigDataInValues.AddRange(primaryKeyValues.Select(it => (object)it));
|
||||
DeleteBuilder.BigDataFiled = primaryField;
|
||||
}
|
||||
return this;
|
||||
@ -248,7 +262,8 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
|
||||
private IDeleteable<T> CopyDeleteable() {
|
||||
private IDeleteable<T> CopyDeleteable()
|
||||
{
|
||||
var asyncContext = this.Context.Utilities.CopyContext(true);
|
||||
asyncContext.CurrentConnectionConfig.IsAutoCloseConnection = true;
|
||||
|
||||
|
@ -33,6 +33,10 @@ namespace SqlSugar
|
||||
RestoreMapping();
|
||||
return this.Ado.ExecuteCommand(sql, UpdateBuilder.Parameters == null ? null : UpdateBuilder.Parameters.ToArray());
|
||||
}
|
||||
public bool ExecuteCommandHasChange()
|
||||
{
|
||||
return this.ExecuteCommand() > 0;
|
||||
}
|
||||
public Task<int> ExecuteCommandAsync()
|
||||
{
|
||||
Task<int> result = new Task<int>(() =>
|
||||
@ -43,6 +47,16 @@ namespace SqlSugar
|
||||
result.Start();
|
||||
return result;
|
||||
}
|
||||
public Task<bool> ExecuteCommandHasChangeAsync()
|
||||
{
|
||||
Task<bool> result = new Task<bool>(() =>
|
||||
{
|
||||
IUpdateable<T> asyncUpdateable = CopyUpdateable();
|
||||
return asyncUpdateable.ExecuteCommand()>0;
|
||||
});
|
||||
result.Start();
|
||||
return result;
|
||||
}
|
||||
public IUpdateable<T> AS(string tableName)
|
||||
{
|
||||
var entityName = typeof(T).Name;
|
||||
|
@ -11,7 +11,9 @@ namespace SqlSugar
|
||||
{
|
||||
DeleteBuilder DeleteBuilder { get; set; }
|
||||
int ExecuteCommand();
|
||||
bool ExecuteCommandHasChange();
|
||||
Task<int> ExecuteCommandAsync();
|
||||
Task<bool> ExecuteCommandHasChangeAsync();
|
||||
IDeleteable<T> AS(string tableName);
|
||||
IDeleteable<T> With(string lockString);
|
||||
IDeleteable<T> Where(T deleteObj);
|
||||
|
@ -11,7 +11,9 @@ namespace SqlSugar
|
||||
{
|
||||
UpdateBuilder UpdateBuilder { get; set; }
|
||||
int ExecuteCommand();
|
||||
bool ExecuteCommandHasChange();
|
||||
Task<int> ExecuteCommandAsync();
|
||||
Task<bool> ExecuteCommandHasChangeAsync();
|
||||
IUpdateable<T> AS(string tableName);
|
||||
IUpdateable<T> With(string lockString);
|
||||
IUpdateable<T> Where(bool isNoUpdateNull,bool IsOffIdentity = false);
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user