mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 14:04:44 +08:00
-
This commit is contained in:
parent
09e37a23ad
commit
c9bc2347e2
@ -91,7 +91,6 @@ namespace SqlSugar
|
|||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<int> ExecuteReturnIdentityAsync()
|
public Task<int> ExecuteReturnIdentityAsync()
|
||||||
{
|
{
|
||||||
Task<int> result = new Task<int>(() =>
|
Task<int> result = new Task<int>(() =>
|
||||||
@ -101,7 +100,6 @@ namespace SqlSugar
|
|||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<T> ExecuteReturnEntityAsync()
|
public Task<T> ExecuteReturnEntityAsync()
|
||||||
{
|
{
|
||||||
Task<T> result = new Task<T>(() =>
|
Task<T> result = new Task<T>(() =>
|
||||||
@ -111,7 +109,6 @@ namespace SqlSugar
|
|||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> ExecuteCommandIdentityIntoEntityAsync()
|
public Task<bool> ExecuteCommandIdentityIntoEntityAsync()
|
||||||
{
|
{
|
||||||
Task<bool> result = new Task<bool>(() =>
|
Task<bool> result = new Task<bool>(() =>
|
||||||
@ -121,7 +118,6 @@ namespace SqlSugar
|
|||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<long> ExecuteReturnBigIdentityAsync()
|
public Task<long> ExecuteReturnBigIdentityAsync()
|
||||||
{
|
{
|
||||||
Task<long> result = new Task<long>(() =>
|
Task<long> result = new Task<long>(() =>
|
||||||
|
@ -8,12 +8,12 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
public class UpdateableProvider<T> : IUpdateable<T>
|
public class UpdateableProvider<T> : IUpdateable<T> where T : class, new()
|
||||||
{
|
{
|
||||||
public SqlSugarClient Context { get; internal set; }
|
public SqlSugarClient Context { get; internal set; }
|
||||||
public EntityInfo EntityInfo { get; internal set; }
|
public EntityInfo EntityInfo { get; internal set; }
|
||||||
public ISqlBuilder SqlBuilder { get; internal set; }
|
public ISqlBuilder SqlBuilder { get; internal set; }
|
||||||
public UpdateBuilder UpdateBuilder { get; set; }
|
public UpdateBuilder UpdateBuilder { get; set; }
|
||||||
public IAdo Ado { get { return Context.Ado; } }
|
public IAdo Ado { get { return Context.Ado; } }
|
||||||
public T[] UpdateObjs { get; set; }
|
public T[] UpdateObjs { get; set; }
|
||||||
public bool IsMappingTable { get { return this.Context.MappingTables != null && this.Context.MappingTables.Any(); } }
|
public bool IsMappingTable { get { return this.Context.MappingTables != null && this.Context.MappingTables.Any(); } }
|
||||||
@ -33,8 +33,14 @@ namespace SqlSugar
|
|||||||
Check.Exception(UpdateBuilder.WhereValues.IsNullOrEmpty() && GetPrimaryKeys().IsNullOrEmpty(), "You cannot have no primary key and no conditions");
|
Check.Exception(UpdateBuilder.WhereValues.IsNullOrEmpty() && GetPrimaryKeys().IsNullOrEmpty(), "You cannot have no primary key and no conditions");
|
||||||
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 Task<int> ExecuteCommandAsync() {
|
public Task<int> ExecuteCommandAsync()
|
||||||
return null;
|
{
|
||||||
|
Task<int> result = new Task<int>(() =>
|
||||||
|
{
|
||||||
|
IUpdateable<T> asyncInsertable = CopyUpdateable();
|
||||||
|
return asyncInsertable.ExecuteCommand();
|
||||||
|
});
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
public IUpdateable<T> AS(string tableName)
|
public IUpdateable<T> AS(string tableName)
|
||||||
{
|
{
|
||||||
@ -87,7 +93,7 @@ namespace SqlSugar
|
|||||||
if (this.WhereColumnList == null) this.WhereColumnList = new List<string>();
|
if (this.WhereColumnList == null) this.WhereColumnList = new List<string>();
|
||||||
foreach (var item in whereColumns)
|
foreach (var item in whereColumns)
|
||||||
{
|
{
|
||||||
this.WhereColumnList.Add(this.Context.EntityProvider.GetDbColumnName<T>(item));
|
this.WhereColumnList.Add(this.Context.EntityProvider.GetDbColumnName<T>(item));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -271,7 +277,8 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
private List<string> GetPrimaryKeys()
|
private List<string> GetPrimaryKeys()
|
||||||
{
|
{
|
||||||
if (this.WhereColumnList.IsValuable()) {
|
if (this.WhereColumnList.IsValuable())
|
||||||
|
{
|
||||||
return this.WhereColumnList;
|
return this.WhereColumnList;
|
||||||
}
|
}
|
||||||
if (this.Context.IsSystemTablesConfig)
|
if (this.Context.IsSystemTablesConfig)
|
||||||
@ -310,8 +317,19 @@ namespace SqlSugar
|
|||||||
asyncContext.Ado.LogEventCompleted = this.Context.Ado.LogEventCompleted;
|
asyncContext.Ado.LogEventCompleted = this.Context.Ado.LogEventCompleted;
|
||||||
asyncContext.Ado.ProcessingEventStartingSQL = this.Context.Ado.ProcessingEventStartingSQL;
|
asyncContext.Ado.ProcessingEventStartingSQL = this.Context.Ado.ProcessingEventStartingSQL;
|
||||||
|
|
||||||
|
var asyncUpdateable = asyncContext.Updateable<T>(this.UpdateObjs);
|
||||||
return null;
|
var asyncInsertableBuilder = asyncUpdateable.UpdateBuilder;
|
||||||
|
asyncInsertableBuilder.DbColumnInfoList = this.UpdateBuilder.DbColumnInfoList;
|
||||||
|
asyncInsertableBuilder.IsNoUpdateNull = this.UpdateBuilder.IsNoUpdateNull;
|
||||||
|
asyncInsertableBuilder.Parameters = this.UpdateBuilder.Parameters;
|
||||||
|
asyncInsertableBuilder.sql = this.UpdateBuilder.sql;
|
||||||
|
asyncInsertableBuilder.WhereValues = this.UpdateBuilder.WhereValues;
|
||||||
|
asyncInsertableBuilder.TableWithString = this.UpdateBuilder.TableWithString;
|
||||||
|
asyncInsertableBuilder.TableName = this.UpdateBuilder.TableName;
|
||||||
|
asyncInsertableBuilder.PrimaryKeys = this.UpdateBuilder.PrimaryKeys;
|
||||||
|
asyncInsertableBuilder.IsOffIdentity = this.UpdateBuilder.IsOffIdentity;
|
||||||
|
asyncInsertableBuilder.SetValues = this.UpdateBuilder.SetValues;
|
||||||
|
return asyncUpdateable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
public interface IUpdateable<T>
|
public interface IUpdateable<T> where T : class, new()
|
||||||
{
|
{
|
||||||
UpdateBuilder UpdateBuilder { get; set; }
|
UpdateBuilder UpdateBuilder { get; set; }
|
||||||
int ExecuteCommand();
|
int ExecuteCommand();
|
||||||
|
Loading…
Reference in New Issue
Block a user