【优化】并发下单场景用户金额变动增加事务锁的悲观锁等待模式,防止出现金额异常情况。

This commit is contained in:
大灰灰
2022-08-01 20:15:26 +08:00
parent 4c6ad4c0dc
commit dfa5d5f49c
5 changed files with 120 additions and 51 deletions

View File

@@ -229,6 +229,18 @@ namespace CoreCms.Net.IRepository
Task<T> QueryByClauseAsync(Expression<Func<T, bool>> predicate, Expression<Func<T, object>> orderByPredicate,
OrderByType orderByType, bool blUseNoLock = false);
/// <summary>
/// 根据条件查询数据(悲观锁等待模式)
/// </summary>
/// <param name="predicate">条件表达式树</param>
/// <param name="orderByPredicate">排序字段</param>
/// <param name="orderByType">排序顺序</param>
/// <param name="blUseTranLock">是否使用TranLock</param>
/// <returns></returns>
Task<T> QueryByClauseWithTranLockAsync(Expression<Func<T, bool>> predicate,
Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseTranLock = false);
/// <summary>
/// 写入实体数据
/// </summary>