mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Synchronization code
This commit is contained in:
parent
a7a8519cdb
commit
f7ea54c203
@ -16,6 +16,8 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public IEnumerable<SplitTableInfo> Tables { get; set; }
|
public IEnumerable<SplitTableInfo> Tables { get; set; }
|
||||||
internal List<string> WhereColumns { get; set; }
|
internal List<string> WhereColumns { get; set; }
|
||||||
|
internal bool IsEnableDiffLogEvent { get; set; }
|
||||||
|
internal object BusinessData { get; set; }
|
||||||
|
|
||||||
public int ExecuteCommandWithOptLock(bool isThrowError = false)
|
public int ExecuteCommandWithOptLock(bool isThrowError = false)
|
||||||
{
|
{
|
||||||
@ -27,6 +29,7 @@ namespace SqlSugar
|
|||||||
var addList = item.Select(it => it.Item).ToList();
|
var addList = item.Select(it => it.Item).ToList();
|
||||||
result += this.Context.Updateable(addList)
|
result += this.Context.Updateable(addList)
|
||||||
.WhereColumns(this.WhereColumns?.ToArray())
|
.WhereColumns(this.WhereColumns?.ToArray())
|
||||||
|
.EnableDiffLogEventIF(this.IsEnableDiffLogEvent,this.BusinessData)
|
||||||
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
|
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
|
||||||
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
|
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
|
||||||
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLock(isThrowError);
|
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLock(isThrowError);
|
||||||
@ -42,6 +45,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
var addList = item.Select(it => it.Item).ToList();
|
var addList = item.Select(it => it.Item).ToList();
|
||||||
result += this.Context.Updateable(addList)
|
result += this.Context.Updateable(addList)
|
||||||
|
.EnableDiffLogEventIF(this.IsEnableDiffLogEvent, this.BusinessData)
|
||||||
.WhereColumns(this.WhereColumns?.ToArray())
|
.WhereColumns(this.WhereColumns?.ToArray())
|
||||||
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
|
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
|
||||||
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity,this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
|
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity,this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
|
||||||
@ -61,6 +65,7 @@ namespace SqlSugar
|
|||||||
var addList = item.Select(it => it.Item).ToList();
|
var addList = item.Select(it => it.Item).ToList();
|
||||||
result += await this.Context.Updateable(addList)
|
result += await this.Context.Updateable(addList)
|
||||||
.WhereColumns(this.WhereColumns?.ToArray())
|
.WhereColumns(this.WhereColumns?.ToArray())
|
||||||
|
.EnableDiffLogEventIF(this.IsEnableDiffLogEvent, this.BusinessData)
|
||||||
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
|
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
|
||||||
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
|
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
|
||||||
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandAsync();
|
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandAsync();
|
||||||
@ -77,6 +82,7 @@ namespace SqlSugar
|
|||||||
var addList = item.Select(it => it.Item).ToList();
|
var addList = item.Select(it => it.Item).ToList();
|
||||||
result += await this.Context.Updateable(addList)
|
result += await this.Context.Updateable(addList)
|
||||||
.WhereColumns(this.WhereColumns?.ToArray())
|
.WhereColumns(this.WhereColumns?.ToArray())
|
||||||
|
.EnableDiffLogEventIF(this.IsEnableDiffLogEvent, this.BusinessData)
|
||||||
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
|
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
|
||||||
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
|
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
|
||||||
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLockAsync(isThrowError);
|
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLockAsync(isThrowError);
|
||||||
|
@ -290,6 +290,8 @@ namespace SqlSugar
|
|||||||
SplitTableUpdateByObjectProvider<T> result = new SplitTableUpdateByObjectProvider<T>();
|
SplitTableUpdateByObjectProvider<T> result = new SplitTableUpdateByObjectProvider<T>();
|
||||||
result.Context = this.Context;
|
result.Context = this.Context;
|
||||||
result.UpdateObjects = this.UpdateObjs;
|
result.UpdateObjects = this.UpdateObjs;
|
||||||
|
result.IsEnableDiffLogEvent = this.IsEnableDiffLogEvent;
|
||||||
|
result.BusinessData = this.diffModel.BusinessData;
|
||||||
if(this.IsWhereColumns)
|
if(this.IsWhereColumns)
|
||||||
result.WhereColumns = this.WhereColumnList;
|
result.WhereColumns = this.WhereColumnList;
|
||||||
SplitTableContext helper = new SplitTableContext(Context)
|
SplitTableContext helper = new SplitTableContext(Context)
|
||||||
|
Loading…
Reference in New Issue
Block a user