Browse Source

Synchronization code

pull/40/head
sunkaixuan 1 year ago
parent
commit
cf9c1436c4
  1. 4
      Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs

4
Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs

@ -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…
Cancel
Save