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