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