mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-08 10:24:55 +08:00
-
This commit is contained in:
@@ -35,8 +35,11 @@ namespace OrmTest.UnitTest
|
||||
//Ignore Name and TestId
|
||||
var s4=db.Insertable<Student>(insertObj).IgnoreColumns(it => new object[] { it.Name,it.TestId }).ToSql();
|
||||
|
||||
//Ignore Name and TestId
|
||||
var s5 = db.Insertable<Student>(insertObj).IgnoreColumns(it => it == "Name" || it == "TestId").With(SqlWith.UpdLock).ToSql();
|
||||
|
||||
//Use Lock
|
||||
var s5=db.Insertable<Student>(insertObj).With(SqlWith.UpdLock).ToSql();
|
||||
var s6 =db.Insertable<Student>(insertObj).With(SqlWith.UpdLock).ToSql();
|
||||
|
||||
//ToSql
|
||||
var s7= db.Insertable<Student>(insertObj).With(SqlWith.UpdLock)
|
||||
|
||||
@@ -53,6 +53,11 @@ namespace SqlSugar
|
||||
this.InsertBuilder.DbColumnInfoList = this.InsertBuilder.DbColumnInfoList.Where(it => !ignoreColumns.Contains(it.EntityPropertyName)).ToList();
|
||||
return this;
|
||||
}
|
||||
public IInsertable<T> IgnoreColumns(Func<string, bool> ignoreColumMethod)
|
||||
{
|
||||
this.InsertBuilder.DbColumnInfoList =this.InsertBuilder.DbColumnInfoList.Where(it => !ignoreColumMethod(it.EntityPropertyName)).ToList();
|
||||
return this;
|
||||
}
|
||||
|
||||
public IInsertable<T> InsertColumns(Expression<Func<T, object[]>> columns)
|
||||
{
|
||||
@@ -91,7 +96,8 @@ namespace SqlSugar
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
@@ -165,6 +171,8 @@ namespace SqlSugar
|
||||
return mappInfo == null ? entityName : mappInfo.DbColumnName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace SqlSugar
|
||||
IInsertable<T> With(string lockString);
|
||||
IInsertable<T> InsertColumns(Expression<Func<T, object[]>> columns);
|
||||
IInsertable<T> IgnoreColumns(Expression<Func<T, object[]>> columns);
|
||||
IInsertable<T> IgnoreColumns(Func<string,bool> ignoreColumMethod);
|
||||
IInsertable<T> Where(bool isInsertNull);
|
||||
KeyValuePair<string, List<SugarParameter>> ToSql();
|
||||
EntityInfo EntityInfo { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user