From e9b992673aa1c9cd8f8acd4df31f4ad84f463776 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 2 Aug 2022 22:32:36 +0800 Subject: [PATCH] Add Check --- .../SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs index 57e4cf617..b802d271e 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs @@ -62,6 +62,7 @@ namespace SqlSugar 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,如果是一对多操作请更新主表统一用主表验证"); var updateData = UpdateObjs.FirstOrDefault(); if (updateData == null) return 0; var name=_ExecuteCommandWithOptLock(updateData); @@ -92,6 +93,7 @@ namespace SqlSugar public virtual async Task 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,如果是一对多操作请更新主表统一用主表验证"); var updateData = UpdateObjs.FirstOrDefault(); if (updateData == null) return 0; var name=_ExecuteCommandWithOptLock(updateData);