mirror of
				https://gitee.com/dotnetchina/SqlSugar.git
				synced 2025-10-26 18:59:17 +08:00 
			
		
		
		
	Add CloseVersionValidation
This commit is contained in:
		| @@ -29,6 +29,7 @@ namespace OrmTest.Demo | ||||
|                     db.Updateable(data).AS("student").ExecuteCommand(); | ||||
|  | ||||
|                     data.CreateTime = time.Value.AddMilliseconds(-1); | ||||
|                     db.Updateable(data).AS("student").CloseVersionValidation().ExecuteCommand();//Close Version Validation | ||||
|                     db.Updateable(data).AS("student").ExecuteCommand();  | ||||
|                 } | ||||
|             } | ||||
|   | ||||
| @@ -107,7 +107,8 @@ namespace OrmTest.Models | ||||
|            /// Desc: | ||||
|            /// Default: | ||||
|            /// Nullable:False | ||||
|            /// </summary>            | ||||
|            /// </summary>  | ||||
|            [SqlSugar.SugarColumn(IsEnableUpdateVersionValidation =true)] | ||||
|            public byte[] Varbinary1 {get;set;} | ||||
|  | ||||
|            /// <summary> | ||||
|   | ||||
| @@ -23,6 +23,7 @@ namespace SqlSugar | ||||
|         private List<string> IgnoreColumnNameList { get; set; } | ||||
|         private List<string> WhereColumnList { get; set; } | ||||
|         private bool IsOffIdentity { get; set; } | ||||
|         private bool IsVersionValidation = true; | ||||
|         public MappingTableList OldMappingTableList { get; set; } | ||||
|         public bool IsAs { get; set; } | ||||
|         public virtual int ExecuteCommand() | ||||
| @@ -79,6 +80,12 @@ namespace SqlSugar | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public IUpdateable<T> CloseVersionValidation() | ||||
|         { | ||||
|             this.IsVersionValidation = false; | ||||
|             return this; | ||||
|         } | ||||
|  | ||||
|         public IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false) | ||||
|         { | ||||
|             UpdateBuilder.IsOffIdentity = isOffIdentity; | ||||
| @@ -460,7 +467,7 @@ namespace SqlSugar | ||||
|         private void ValidateVersion() | ||||
|         { | ||||
|             var versionColumn = this.EntityInfo.Columns.FirstOrDefault(it => it.IsEnableUpdateVersionValidation); | ||||
|             if (versionColumn != null) | ||||
|             if (versionColumn != null && this.IsVersionValidation) | ||||
|             { | ||||
|                 var pks = this.UpdateBuilder.DbColumnInfoList.Where(it => it.IsPrimarykey).ToList(); | ||||
|                 List<IConditionalModel> conModels = new List<IConditionalModel>(); | ||||
|   | ||||
| @@ -41,6 +41,7 @@ namespace SqlSugar | ||||
|         IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false); | ||||
|         IUpdateable<T> IgnoreColumns(Expression<Func<T, object>> columns); | ||||
|         IUpdateable<T> IgnoreColumns(Func<string, bool> ignoreColumMethod); | ||||
|         IUpdateable<T> CloseVersionValidation(); | ||||
|         IUpdateable<T> ReSetValue(Expression<Func<T, bool>> setValueExpression); | ||||
|         IUpdateable<T> RemoveDataCache(); | ||||
|         KeyValuePair<string,List<SugarParameter>> ToSql(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 sunkaixuan
					sunkaixuan