Upadte db.Queryable<T>().TranLock

This commit is contained in:
sunkaixuan
2022-08-23 20:10:17 +08:00
parent cad0b8955a
commit 57f36a37a8
2 changed files with 3 additions and 2 deletions

View File

@@ -422,8 +422,9 @@ namespace SqlSugar
_WhereClassByPrimaryKey(new List<T>() { data });
return this;
}
public ISugarQueryable<T> TranLock(DbLockType LockType = DbLockType.Wait)
public ISugarQueryable<T> TranLock(DbLockType? LockType = DbLockType.Wait)
{
if (LockType == null) return this;
Check.ExceptionEasy(this.Context.Ado.Transaction == null, "need BeginTran", "需要事务才能使用TranLock");
Check.ExceptionEasy(this.QueryBuilder.IsSingle()==false, "TranLock, can only be used for single table query", "TranLock只能用在单表查询");
if (this.Context.CurrentConnectionConfig.DbType == DbType.SqlServer)

View File

@@ -58,7 +58,7 @@ namespace SqlSugar
ISugarQueryable<T> WhereColumns(List<Dictionary<string, object>> columns);
ISugarQueryable<T> WhereColumns(Dictionary<string, object> columns, bool ignoreDefaultValue);
ISugarQueryable<T> WhereColumns(Dictionary<string, object> columns);
ISugarQueryable<T> TranLock(DbLockType LockType = DbLockType.Wait);
ISugarQueryable<T> TranLock(DbLockType? LockType = DbLockType.Wait);
ISugarQueryable<T> Where(Expression<Func<T, bool>> expression);
ISugarQueryable<T> Where(string whereString, object parameters = null);
ISugarQueryable<T> Where(List<IConditionalModel> conditionalModels);