mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-01 10:10:16 +08:00
Update Storageable
This commit is contained in:
parent
56760c6de2
commit
ab7f62a26c
@ -84,6 +84,18 @@ namespace SqlSugar
|
||||
this.lockType = dbLockType;
|
||||
return this;
|
||||
}
|
||||
public IStorageable<T> TranLock(DbLockType? LockType)
|
||||
{
|
||||
if (LockType!=null)
|
||||
{
|
||||
this.lockType = LockType;
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
public IStorageable<T> SplitOther(Func<StorageableInfo<T>, bool> conditions, string message = null)
|
||||
{
|
||||
whereFuncs.Add(new KeyValuePair<StorageType, Func<StorageableInfo<T>, bool>, string>(StorageType.Other, conditions, message));
|
||||
@ -102,6 +114,7 @@ namespace SqlSugar
|
||||
page.ActionCallBack = ActionCallBack;
|
||||
page.TableName = this.asname;
|
||||
page.whereExpression = this.whereExpression;
|
||||
page.lockType = this.lockType;
|
||||
return page;
|
||||
}
|
||||
public StorageableSplitProvider<T> SplitTable()
|
||||
|
@ -9,6 +9,8 @@ namespace SqlSugar
|
||||
{
|
||||
public class StorageablePage<T> where T : class,new()
|
||||
{
|
||||
internal DbLockType? lockType { get; set; }
|
||||
|
||||
public SqlSugarProvider Context { get; set; }
|
||||
public List<T> Data { get; set; }
|
||||
public int PageSize { get; internal set; }
|
||||
@ -33,7 +35,7 @@ namespace SqlSugar
|
||||
}
|
||||
this.Context.Utilities.PageEach(Data, PageSize, pageItem =>
|
||||
{
|
||||
result += this.Context.Storageable(pageItem).As(TableName).WhereColumns(whereExpression).ExecuteCommand();
|
||||
result += this.Context.Storageable(pageItem).As(TableName).TranLock(lockType).WhereColumns(whereExpression).ExecuteCommand();
|
||||
if (ActionCallBack != null)
|
||||
{
|
||||
ActionCallBack(result);
|
||||
@ -71,7 +73,7 @@ namespace SqlSugar
|
||||
}
|
||||
await this.Context.Utilities.PageEachAsync(Data, PageSize, async pageItem =>
|
||||
{
|
||||
result += await this.Context.Storageable(pageItem).As(TableName).WhereColumns(whereExpression).ExecuteCommandAsync();
|
||||
result += await this.Context.Storageable(pageItem).As(TableName).TranLock(lockType).WhereColumns(whereExpression).ExecuteCommandAsync();
|
||||
if (ActionCallBack != null)
|
||||
{
|
||||
ActionCallBack(result);
|
||||
@ -106,7 +108,7 @@ namespace SqlSugar
|
||||
|
||||
this.Context.Utilities.PageEach(Data, PageSize, pageItem =>
|
||||
{
|
||||
result += this.Context.Storageable(pageItem).As(TableName).WhereColumns(whereExpression).ExecuteSqlBulkCopy();
|
||||
result += this.Context.Storageable(pageItem).As(TableName).TranLock(lockType).WhereColumns(whereExpression).ExecuteSqlBulkCopy();
|
||||
if (ActionCallBack != null)
|
||||
{
|
||||
ActionCallBack(result);
|
||||
@ -132,7 +134,7 @@ namespace SqlSugar
|
||||
{
|
||||
await this.Context.Utilities.PageEachAsync(Data, PageSize, async pageItem =>
|
||||
{
|
||||
result += await this.Context.Storageable(pageItem).As(TableName).WhereColumns(whereExpression).ExecuteSqlBulkCopyAsync();
|
||||
result += await this.Context.Storageable(pageItem).As(TableName).TranLock(lockType).WhereColumns(whereExpression).ExecuteSqlBulkCopyAsync();
|
||||
if (ActionCallBack != null)
|
||||
{
|
||||
ActionCallBack(result);
|
||||
|
@ -20,6 +20,7 @@ namespace SqlSugar
|
||||
IStorageable<T> SplitIgnore(Func<StorageableInfo<T>, bool> conditions, string message = null);
|
||||
IStorageable<T> DisableFilters();
|
||||
IStorageable<T> TranLock(DbLockType LockType = DbLockType.Wait);
|
||||
IStorageable<T> TranLock(DbLockType? LockType);
|
||||
IStorageable<T> SplitDelete(Func<StorageableInfo<T>, bool> conditions, string message = null);
|
||||
IStorageable<T> SplitOther(Func<StorageableInfo<T>, bool> conditions, string message = null);
|
||||
StorageableResult<T> ToStorage();
|
||||
|
Loading…
Reference in New Issue
Block a user