mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-08 02:14:53 +08:00
Update db.Storageable
This commit is contained in:
@@ -125,6 +125,9 @@ namespace SqlSugar
|
||||
var other = messageList.Where(it => it.StorageType == StorageType.Other).ToList();
|
||||
StorageableResult<T> result = new StorageableResult<T>()
|
||||
{
|
||||
_IsWhereColumn= this.whereExpression != null,
|
||||
_AsName =asname,
|
||||
_Context=this.Context,
|
||||
AsDeleteable = this.Context.Deleteable<T>().AS(asname),
|
||||
AsUpdateable = this.Context.Updateable(update.Select(it => it.Item).ToList()).AS(asname),
|
||||
AsInsertable = this.Context.Insertable(inset.Select(it => it.Item).ToList()).AS(asname),
|
||||
|
||||
@@ -88,5 +88,28 @@ namespace SqlSugar
|
||||
public IInsertable<T> AsInsertable { get; set; }
|
||||
public IUpdateable<T> AsUpdateable { get; set; }
|
||||
public IDeleteable<T> AsDeleteable { get; set; }
|
||||
internal bool _IsWhereColumn { get; set; }
|
||||
internal string _AsName { get; set; }
|
||||
internal SqlSugarProvider _Context { get; set; }
|
||||
|
||||
public int BulkCopy()
|
||||
{
|
||||
return this._Context.Fastest<T>().AS(_AsName).BulkCopy(InsertList.Select(it=>it.Item).ToList());
|
||||
}
|
||||
public Task<int> BulkCopyAsync()
|
||||
{
|
||||
return this._Context.Fastest<T>().AS(_AsName).BulkCopyAsync(InsertList.Select(it => it.Item).ToList());
|
||||
}
|
||||
|
||||
public int BulkUpdate()
|
||||
{
|
||||
Check.Exception(_IsWhereColumn, "Storageable.BulkCopy no support WhereColumns");
|
||||
return this._Context.Fastest<T>().AS(_AsName).BulkUpdate(UpdateList.Select(it => it.Item).ToList());
|
||||
}
|
||||
public Task<int> BulkUpdateAsync()
|
||||
{
|
||||
Check.Exception(_IsWhereColumn, "Storageable.BulkCopy no support WhereColumns");
|
||||
return this._Context.Fastest<T>().AS(_AsName).BulkUpdateAsync(UpdateList.Select(it => it.Item).ToList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user