mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-30 12:47:57 +08:00
Synchronization code
This commit is contained in:
parent
911574069b
commit
cf9c1436c4
@ -77,7 +77,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public virtual int ExecuteCommandWithOptLock(bool IsVersionValidation=false)
|
public virtual int ExecuteCommandWithOptLock(bool IsVersionValidation=false)
|
||||||
{
|
{
|
||||||
Check.ExceptionEasy(this.UpdateBuilder.IsListUpdate==true, " OptLock can only be used on a single object, and the argument cannot be List", "乐观锁只能用于单个对象,参数不能是List,如果是一对多操作请更新主表统一用主表验证");
|
Check.ExceptionEasy(UpdateObjs?.Length>1, " OptLock can only be used on a single object, and the argument cannot be List", "乐观锁只能用于单个对象,参数不能是List,如果是一对多操作请更新主表统一用主表验证");
|
||||||
var updateData = UpdateObjs.FirstOrDefault();
|
var updateData = UpdateObjs.FirstOrDefault();
|
||||||
if (updateData == null) return 0;
|
if (updateData == null) return 0;
|
||||||
object oldValue = null;
|
object oldValue = null;
|
||||||
@ -121,7 +121,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public virtual async Task<int> ExecuteCommandWithOptLockAsync(bool IsVersionValidation = false)
|
public virtual async Task<int> ExecuteCommandWithOptLockAsync(bool IsVersionValidation = false)
|
||||||
{
|
{
|
||||||
Check.ExceptionEasy(this.UpdateBuilder.IsListUpdate == true, " OptLock can only be used on a single object, and the argument cannot be List", "乐观锁只能用于单个对象,参数不能是List,如果是一对多操作请更新主表统一用主表验证");
|
Check.ExceptionEasy(UpdateObjs?.Length > 1, " OptLock can only be used on a single object, and the argument cannot be List", "乐观锁只能用于单个对象,参数不能是List,如果是一对多操作请更新主表统一用主表验证");
|
||||||
var updateData = UpdateObjs.FirstOrDefault();
|
var updateData = UpdateObjs.FirstOrDefault();
|
||||||
if (updateData == null) return 0;
|
if (updateData == null) return 0;
|
||||||
object oldValue = null;
|
object oldValue = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user