mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-02-05 00:49:49 +08:00
【修复】修复后台支付单生成校验失败的问题。
【优化】新增SqlSugarExtensions扩展类,增加是否使用WITH(NoLock)方法扩展封装,删除BaseRepository中的一些冗余代码。
This commit is contained in:
@@ -47,9 +47,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns>泛型实体</returns>
|
/// <returns>泛型实体</returns>
|
||||||
public T QueryById(object pkValue, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public T QueryById(object pkValue, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return DbBaseClient.Queryable<T>().WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).InSingle(pkValue);
|
||||||
? DbBaseClient.Queryable<T>().With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).InSingle(pkValue)
|
|
||||||
: DbBaseClient.Queryable<T>().WithCacheIF(isDataCache, cacheTimes).InSingle(pkValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -62,9 +60,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns>数据实体</returns>
|
/// <returns>数据实体</returns>
|
||||||
public async Task<T> QueryByIdAsync(object objId, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<T> QueryByIdAsync(object objId, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return await DbBaseClient.Queryable<T>().In(objId).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).SingleAsync();
|
||||||
? await DbBaseClient.Queryable<T>().In(objId).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).SingleAsync()
|
|
||||||
: await DbBaseClient.Queryable<T>().In(objId).WithCacheIF(isDataCache, cacheTimes).SingleAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -77,9 +73,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
||||||
public List<T> QueryByIDs(object[] lstIds, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public List<T> QueryByIDs(object[] lstIds, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return DbBaseClient.Queryable<T>().In(lstIds).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToList();
|
||||||
? DbBaseClient.Queryable<T>().In(lstIds).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToList()
|
|
||||||
: DbBaseClient.Queryable<T>().In(lstIds).WithCacheIF(isDataCache, cacheTimes).ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -92,9 +86,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
||||||
public async Task<List<T>> QueryByIDsAsync(object[] lstIds, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<List<T>> QueryByIDsAsync(object[] lstIds, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return await DbBaseClient.Queryable<T>().In(lstIds).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
||||||
? await DbBaseClient.Queryable<T>().In(lstIds).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync()
|
|
||||||
: await DbBaseClient.Queryable<T>().In(lstIds).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -107,9 +99,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
||||||
public List<T> QueryByIDs(int[] lstIds, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public List<T> QueryByIDs(int[] lstIds, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return DbBaseClient.Queryable<T>().In(lstIds).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToList();
|
||||||
? DbBaseClient.Queryable<T>().In(lstIds).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToList()
|
|
||||||
: DbBaseClient.Queryable<T>().In(lstIds).WithCacheIF(isDataCache, cacheTimes).ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -122,9 +112,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
||||||
public async Task<List<T>> QueryByIDsAsync(int[] lstIds, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<List<T>> QueryByIDsAsync(int[] lstIds, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return await DbBaseClient.Queryable<T>().In(lstIds).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
||||||
? await DbBaseClient.Queryable<T>().In(lstIds).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync()
|
|
||||||
: await DbBaseClient.Queryable<T>().In(lstIds).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -136,9 +124,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<T> Query(bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public List<T> Query(bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return DbBaseClient.Queryable<T>().WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToList();
|
||||||
? DbBaseClient.Queryable<T>().With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToList()
|
|
||||||
: DbBaseClient.Queryable<T>().WithCacheIF(isDataCache, cacheTimes).ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -150,9 +136,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<T>> QueryAsync(bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<List<T>> QueryAsync(bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return await DbBaseClient.Queryable<T>().WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
||||||
? await DbBaseClient.Queryable<T>().With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync()
|
|
||||||
: await DbBaseClient.Queryable<T>().WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -166,16 +150,10 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns>泛型实体集合</returns>
|
/// <returns>泛型实体集合</returns>
|
||||||
public List<T> QueryListByClause(string strWhere, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public List<T> QueryListByClause(string strWhere, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return DbBaseClient.Queryable<T>()
|
||||||
? DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
|
||||||
.WhereIF(!string.IsNullOrEmpty(strWhere), strWhere)
|
|
||||||
.With(SqlWith.NoLock)
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
|
||||||
.ToList()
|
|
||||||
: DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
||||||
.WhereIF(!string.IsNullOrEmpty(strWhere), strWhere)
|
.WhereIF(!string.IsNullOrEmpty(strWhere), strWhere)
|
||||||
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@@ -191,16 +169,10 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
||||||
public async Task<List<T>> QueryListByClauseAsync(string strWhere, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<List<T>> QueryListByClauseAsync(string strWhere, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return await DbBaseClient.Queryable<T>()
|
||||||
? await DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
|
||||||
.WhereIF(!string.IsNullOrEmpty(strWhere), strWhere)
|
|
||||||
.With(SqlWith.NoLock)
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
|
||||||
.ToListAsync()
|
|
||||||
: await DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
||||||
.WhereIF(!string.IsNullOrEmpty(strWhere), strWhere)
|
.WhereIF(!string.IsNullOrEmpty(strWhere), strWhere)
|
||||||
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
@@ -216,16 +188,10 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
||||||
public List<T> QueryListByClause(Expression<Func<T, bool>> predicate, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public List<T> QueryListByClause(Expression<Func<T, bool>> predicate, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return DbBaseClient.Queryable<T>()
|
||||||
? DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
|
||||||
.WhereIF(predicate != null, predicate)
|
|
||||||
.With(SqlWith.NoLock)
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
|
||||||
.ToList()
|
|
||||||
: DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
||||||
.WhereIF(predicate != null, predicate)
|
.WhereIF(predicate != null, predicate)
|
||||||
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@@ -241,16 +207,10 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
/// <param name="cacheTimes">缓存时长(分钟)</param>
|
||||||
public async Task<List<T>> QueryListByClauseAsync(Expression<Func<T, bool>> predicate, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<List<T>> QueryListByClauseAsync(Expression<Func<T, bool>> predicate, string orderBy = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return await DbBaseClient.Queryable<T>()
|
||||||
? await DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
|
||||||
.WhereIF(predicate != null, predicate)
|
|
||||||
.With(SqlWith.NoLock)
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
|
||||||
.ToListAsync()
|
|
||||||
: await DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
||||||
.WhereIF(predicate != null, predicate)
|
.WhereIF(predicate != null, predicate)
|
||||||
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
@@ -267,16 +227,10 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns>泛型实体集合</returns>
|
/// <returns>泛型实体集合</returns>
|
||||||
public List<T> QueryListByClause(Expression<Func<T, bool>> predicate, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public List<T> QueryListByClause(Expression<Func<T, bool>> predicate, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return DbBaseClient.Queryable<T>()
|
||||||
? DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
|
||||||
.WhereIF(predicate != null, predicate)
|
|
||||||
.With(SqlWith.NoLock)
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
|
||||||
.ToList()
|
|
||||||
: DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
||||||
.WhereIF(predicate != null, predicate)
|
.WhereIF(predicate != null, predicate)
|
||||||
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@@ -293,16 +247,10 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns>泛型实体集合</returns>
|
/// <returns>泛型实体集合</returns>
|
||||||
public async Task<List<T>> QueryListByClauseAsync(Expression<Func<T, bool>> predicate, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<List<T>> QueryListByClauseAsync(Expression<Func<T, bool>> predicate, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return await DbBaseClient.Queryable<T>()
|
||||||
? await DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
|
||||||
.WhereIF(predicate != null, predicate)
|
|
||||||
.With(SqlWith.NoLock)
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
|
||||||
.ToListAsync()
|
|
||||||
: await DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
||||||
.WhereIF(predicate != null, predicate)
|
.WhereIF(predicate != null, predicate)
|
||||||
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
@@ -320,18 +268,11 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<T> QueryListByClause(Expression<Func<T, bool>> predicate, int take, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public List<T> QueryListByClause(Expression<Func<T, bool>> predicate, int take, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return DbBaseClient.Queryable<T>()
|
||||||
? DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
|
||||||
.WhereIF(predicate != null, predicate)
|
|
||||||
.Take(take)
|
|
||||||
.With(SqlWith.NoLock)
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
|
||||||
.ToList()
|
|
||||||
: DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
||||||
.WhereIF(predicate != null, predicate)
|
.WhereIF(predicate != null, predicate)
|
||||||
.Take(take)
|
.Take(take)
|
||||||
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@@ -349,18 +290,11 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<T>> QueryListByClauseAsync(Expression<Func<T, bool>> predicate, int take, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<List<T>> QueryListByClauseAsync(Expression<Func<T, bool>> predicate, int take, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return await DbBaseClient.Queryable<T>()
|
||||||
? await DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
|
||||||
.WhereIF(predicate != null, predicate)
|
|
||||||
.Take(take)
|
|
||||||
.With(SqlWith.NoLock)
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
|
||||||
.ToListAsync()
|
|
||||||
: await DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
.OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
|
||||||
.WhereIF(predicate != null, predicate)
|
.WhereIF(predicate != null, predicate)
|
||||||
.Take(take)
|
.Take(take)
|
||||||
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
@@ -377,18 +311,11 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<T> QueryListByClause(Expression<Func<T, bool>> predicate, int take, string strOrderByFields = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public List<T> QueryListByClause(Expression<Func<T, bool>> predicate, int take, string strOrderByFields = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return DbBaseClient.Queryable<T>()
|
||||||
? DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(!string.IsNullOrEmpty(strOrderByFields), strOrderByFields)
|
|
||||||
.Where(predicate)
|
|
||||||
.Take(take)
|
|
||||||
.With(SqlWith.NoLock)
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
|
||||||
.ToList()
|
|
||||||
: DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(!string.IsNullOrEmpty(strOrderByFields), strOrderByFields)
|
.OrderByIF(!string.IsNullOrEmpty(strOrderByFields), strOrderByFields)
|
||||||
.Where(predicate)
|
.Where(predicate)
|
||||||
.Take(take)
|
.Take(take)
|
||||||
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@@ -405,18 +332,11 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<T>> QueryListByClauseAsync(Expression<Func<T, bool>> predicate, int take, string strOrderByFields = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<List<T>> QueryListByClauseAsync(Expression<Func<T, bool>> predicate, int take, string strOrderByFields = "", bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return await DbBaseClient.Queryable<T>()
|
||||||
? await DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(!string.IsNullOrEmpty(strOrderByFields), strOrderByFields)
|
|
||||||
.Where(predicate)
|
|
||||||
.Take(take)
|
|
||||||
.With(SqlWith.NoLock)
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
|
||||||
.ToListAsync()
|
|
||||||
: await DbBaseClient.Queryable<T>()
|
|
||||||
.OrderByIF(!string.IsNullOrEmpty(strOrderByFields), strOrderByFields)
|
.OrderByIF(!string.IsNullOrEmpty(strOrderByFields), strOrderByFields)
|
||||||
.Where(predicate)
|
.Where(predicate)
|
||||||
.Take(take)
|
.Take(take)
|
||||||
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
@@ -431,12 +351,8 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public T QueryByClause(Expression<Func<T, bool>> predicate, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public T QueryByClause(Expression<Func<T, bool>> predicate, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return DbBaseClient.Queryable<T>()
|
||||||
? DbBaseClient.Queryable<T>()
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.With(SqlWith.NoLock)
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
|
||||||
.First(predicate)
|
|
||||||
: DbBaseClient.Queryable<T>()
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.First(predicate);
|
.First(predicate);
|
||||||
}
|
}
|
||||||
@@ -451,12 +367,8 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<T> QueryByClauseAsync(Expression<Func<T, bool>> predicate, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<T> QueryByClauseAsync(Expression<Func<T, bool>> predicate, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return await DbBaseClient.Queryable<T>()
|
||||||
? await DbBaseClient.Queryable<T>()
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.With(SqlWith.NoLock)
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
|
||||||
.FirstAsync(predicate)
|
|
||||||
: await DbBaseClient.Queryable<T>()
|
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.FirstAsync(predicate);
|
.FirstAsync(predicate);
|
||||||
}
|
}
|
||||||
@@ -473,9 +385,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public T QueryByClause(Expression<Func<T, bool>> predicate, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public T QueryByClause(Expression<Func<T, bool>> predicate, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return DbBaseClient.Queryable<T>().OrderBy(orderByPredicate, orderByType).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).First(predicate);
|
||||||
? DbBaseClient.Queryable<T>().OrderBy(orderByPredicate, orderByType).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).First(predicate)
|
|
||||||
: DbBaseClient.Queryable<T>().OrderBy(orderByPredicate, orderByType).WithCacheIF(isDataCache, cacheTimes).First(predicate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -490,9 +400,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<T> QueryByClauseAsync(Expression<Func<T, bool>> predicate, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<T> QueryByClauseAsync(Expression<Func<T, bool>> predicate, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return await DbBaseClient.Queryable<T>().OrderBy(orderByPredicate, orderByType).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).FirstAsync(predicate);
|
||||||
? await DbBaseClient.Queryable<T>().OrderBy(orderByPredicate, orderByType).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).FirstAsync(predicate)
|
|
||||||
: await DbBaseClient.Queryable<T>().OrderBy(orderByPredicate, orderByType).WithCacheIF(isDataCache, cacheTimes).FirstAsync(predicate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -508,9 +416,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<T> QueryByClauseWithTranLockAsync(Expression<Func<T, bool>> predicate, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseTranLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<T> QueryByClauseWithTranLockAsync(Expression<Func<T, bool>> predicate, Expression<Func<T, object>> orderByPredicate, OrderByType orderByType, bool blUseTranLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseTranLock
|
return await DbBaseClient.Queryable<T>().TranLock(DbLockType.Wait).OrderBy(orderByPredicate, orderByType).WithCacheIF(isDataCache, cacheTimes).FirstAsync(predicate);
|
||||||
? await DbBaseClient.Queryable<T>().TranLock(DbLockType.Wait).OrderBy(orderByPredicate, orderByType).WithCacheIF(isDataCache, cacheTimes).FirstAsync(predicate)
|
|
||||||
: await DbBaseClient.Queryable<T>().OrderBy(orderByPredicate, orderByType).WithCacheIF(isDataCache, cacheTimes).FirstAsync(predicate);
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -1125,9 +1031,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool Exists(Expression<Func<T, bool>> predicate, bool blUseNoLock = false)
|
public bool Exists(Expression<Func<T, bool>> predicate, bool blUseNoLock = false)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return DbBaseClient.Queryable<T>().Where(predicate).WithNoLockOrNot(blUseNoLock).Any();
|
||||||
? DbBaseClient.Queryable<T>().Where(predicate).With(SqlWith.NoLock).Any()
|
|
||||||
: DbBaseClient.Queryable<T>().Where(predicate).Any();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1138,9 +1042,7 @@ namespace CoreCms.Net.Repository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> ExistsAsync(Expression<Func<T, bool>> predicate, bool blUseNoLock = false)
|
public async Task<bool> ExistsAsync(Expression<Func<T, bool>> predicate, bool blUseNoLock = false)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return await DbBaseClient.Queryable<T>().Where(predicate).WithNoLockOrNot(blUseNoLock).AnyAsync();
|
||||||
? await DbBaseClient.Queryable<T>().Where(predicate).With(SqlWith.NoLock).AnyAsync()
|
|
||||||
: await DbBaseClient.Queryable<T>().Where(predicate).AnyAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -1158,7 +1060,7 @@ namespace CoreCms.Net.Repository
|
|||||||
public int GetCount(Expression<Func<T, bool>> predicate, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public int GetCount(Expression<Func<T, bool>> predicate, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? DbBaseClient.Queryable<T>().With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).Count(predicate)
|
? DbBaseClient.Queryable<T>().WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).Count(predicate)
|
||||||
: DbBaseClient.Queryable<T>().WithCacheIF(isDataCache, cacheTimes).Count(predicate);
|
: DbBaseClient.Queryable<T>().WithCacheIF(isDataCache, cacheTimes).Count(predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1173,7 +1075,7 @@ namespace CoreCms.Net.Repository
|
|||||||
public async Task<int> GetCountAsync(Expression<Func<T, bool>> predicate, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public async Task<int> GetCountAsync(Expression<Func<T, bool>> predicate, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? await DbBaseClient.Queryable<T>().With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).CountAsync(predicate)
|
? await DbBaseClient.Queryable<T>().WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).CountAsync(predicate)
|
||||||
: await DbBaseClient.Queryable<T>().WithCacheIF(isDataCache, cacheTimes).CountAsync(predicate);
|
: await DbBaseClient.Queryable<T>().WithCacheIF(isDataCache, cacheTimes).CountAsync(predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1189,7 +1091,7 @@ namespace CoreCms.Net.Repository
|
|||||||
public int GetSum(Expression<Func<T, bool>> predicate, Expression<Func<T, int>> field, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
public int GetSum(Expression<Func<T, bool>> predicate, Expression<Func<T, int>> field, bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? DbBaseClient.Queryable<T>().Where(predicate).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).Sum(field)
|
? DbBaseClient.Queryable<T>().Where(predicate).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).Sum(field)
|
||||||
: DbBaseClient.Queryable<T>().Where(predicate).WithCacheIF(isDataCache, cacheTimes).Sum(field);
|
: DbBaseClient.Queryable<T>().Where(predicate).WithCacheIF(isDataCache, cacheTimes).Sum(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1206,7 +1108,7 @@ namespace CoreCms.Net.Repository
|
|||||||
bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? await DbBaseClient.Queryable<T>().Where(predicate).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).SumAsync(field)
|
? await DbBaseClient.Queryable<T>().Where(predicate).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).SumAsync(field)
|
||||||
: await DbBaseClient.Queryable<T>().Where(predicate).WithCacheIF(isDataCache, cacheTimes).SumAsync(field);
|
: await DbBaseClient.Queryable<T>().Where(predicate).WithCacheIF(isDataCache, cacheTimes).SumAsync(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1223,7 +1125,7 @@ namespace CoreCms.Net.Repository
|
|||||||
bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? DbBaseClient.Queryable<T>().Where(predicate).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).Sum(field)
|
? DbBaseClient.Queryable<T>().Where(predicate).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).Sum(field)
|
||||||
: DbBaseClient.Queryable<T>().Where(predicate).WithCacheIF(isDataCache, cacheTimes).Sum(field);
|
: DbBaseClient.Queryable<T>().Where(predicate).WithCacheIF(isDataCache, cacheTimes).Sum(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1240,7 +1142,7 @@ namespace CoreCms.Net.Repository
|
|||||||
bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? await DbBaseClient.Queryable<T>().Where(predicate).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).SumAsync(field)
|
? await DbBaseClient.Queryable<T>().Where(predicate).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).SumAsync(field)
|
||||||
: await DbBaseClient.Queryable<T>().Where(predicate).WithCacheIF(isDataCache, cacheTimes).SumAsync(field);
|
: await DbBaseClient.Queryable<T>().Where(predicate).WithCacheIF(isDataCache, cacheTimes).SumAsync(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1257,7 +1159,7 @@ namespace CoreCms.Net.Repository
|
|||||||
bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? DbBaseClient.Queryable<T>().Where(predicate).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).Sum(field)
|
? DbBaseClient.Queryable<T>().Where(predicate).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).Sum(field)
|
||||||
: DbBaseClient.Queryable<T>().Where(predicate).WithCacheIF(isDataCache, cacheTimes).Sum(field);
|
: DbBaseClient.Queryable<T>().Where(predicate).WithCacheIF(isDataCache, cacheTimes).Sum(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1274,7 +1176,7 @@ namespace CoreCms.Net.Repository
|
|||||||
bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
bool blUseNoLock = false, bool isDataCache = false, int cacheTimes = int.MaxValue)
|
||||||
{
|
{
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? await DbBaseClient.Queryable<T>().Where(predicate).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).SumAsync(field)
|
? await DbBaseClient.Queryable<T>().Where(predicate).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).SumAsync(field)
|
||||||
: await DbBaseClient.Queryable<T>().Where(predicate).WithCacheIF(isDataCache, cacheTimes).SumAsync(field);
|
: await DbBaseClient.Queryable<T>().Where(predicate).WithCacheIF(isDataCache, cacheTimes).SumAsync(field);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -1301,7 +1203,7 @@ namespace CoreCms.Net.Repository
|
|||||||
? DbBaseClient.Queryable<T>()
|
? DbBaseClient.Queryable<T>()
|
||||||
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
||||||
.WhereIF(predicate != null, predicate)
|
.WhereIF(predicate != null, predicate)
|
||||||
.With(SqlWith.NoLock)
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToPageList(pageIndex, pageSize, ref totalCount)
|
.ToPageList(pageIndex, pageSize, ref totalCount)
|
||||||
: DbClient.Queryable<T>()
|
: DbClient.Queryable<T>()
|
||||||
@@ -1333,7 +1235,7 @@ namespace CoreCms.Net.Repository
|
|||||||
? await DbBaseClient.Queryable<T>()
|
? await DbBaseClient.Queryable<T>()
|
||||||
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
.OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
|
||||||
.WhereIF(predicate != null, predicate)
|
.WhereIF(predicate != null, predicate)
|
||||||
.With(SqlWith.NoLock)
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToPageListAsync(pageIndex, pageSize, totalCount)
|
.ToPageListAsync(pageIndex, pageSize, totalCount)
|
||||||
: await DbBaseClient.Queryable<T>()
|
: await DbBaseClient.Queryable<T>()
|
||||||
@@ -1366,7 +1268,7 @@ namespace CoreCms.Net.Repository
|
|||||||
? DbBaseClient.Queryable<T>().
|
? DbBaseClient.Queryable<T>().
|
||||||
OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||||
.WhereIF(predicate != null, predicate)
|
.WhereIF(predicate != null, predicate)
|
||||||
.With(SqlWith.NoLock)
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToPageList(pageIndex, pageSize, ref totalCount)
|
.ToPageList(pageIndex, pageSize, ref totalCount)
|
||||||
: DbBaseClient.Queryable<T>().
|
: DbBaseClient.Queryable<T>().
|
||||||
@@ -1399,7 +1301,7 @@ namespace CoreCms.Net.Repository
|
|||||||
? await DbBaseClient.Queryable<T>()
|
? await DbBaseClient.Queryable<T>()
|
||||||
.WhereIF(predicate != null, predicate)
|
.WhereIF(predicate != null, predicate)
|
||||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||||
.With(SqlWith.NoLock)
|
.WithNoLockOrNot(blUseNoLock)
|
||||||
.WithCacheIF(isDataCache, cacheTimes)
|
.WithCacheIF(isDataCache, cacheTimes)
|
||||||
.ToPageListAsync(pageIndex, pageSize, totalCount)
|
.ToPageListAsync(pageIndex, pageSize, totalCount)
|
||||||
: await DbBaseClient.Queryable<T>()
|
: await DbBaseClient.Queryable<T>()
|
||||||
@@ -1435,10 +1337,10 @@ namespace CoreCms.Net.Repository
|
|||||||
{
|
{
|
||||||
if (whereLambda == null)
|
if (whereLambda == null)
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? DbBaseClient.Queryable(joinExpression).Select(selectExpression).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToList()
|
? DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToList()
|
||||||
: DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToList();
|
: DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToList();
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToList()
|
? DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToList()
|
||||||
: DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToList();
|
: DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1463,10 +1365,10 @@ namespace CoreCms.Net.Repository
|
|||||||
{
|
{
|
||||||
if (whereLambda == null)
|
if (whereLambda == null)
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? await DbBaseClient.Queryable(joinExpression).Select(selectExpression).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync()
|
? await DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync()
|
||||||
: await DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
: await DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? await DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync()
|
? await DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync()
|
||||||
: await DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
: await DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1491,10 +1393,10 @@ namespace CoreCms.Net.Repository
|
|||||||
{
|
{
|
||||||
if (whereLambda == null)
|
if (whereLambda == null)
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? DbBaseClient.Queryable(joinExpression).Select(selectExpression).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).First()
|
? DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).First()
|
||||||
: DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).First();
|
: DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).First();
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).First()
|
? DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).First()
|
||||||
: DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).First();
|
: DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).First();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1519,10 +1421,10 @@ namespace CoreCms.Net.Repository
|
|||||||
{
|
{
|
||||||
if (whereLambda == null)
|
if (whereLambda == null)
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? await DbBaseClient.Queryable(joinExpression).Select(selectExpression).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).FirstAsync()
|
? await DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).FirstAsync()
|
||||||
: await DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).FirstAsync();
|
: await DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).FirstAsync();
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? await DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).FirstAsync()
|
? await DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).FirstAsync()
|
||||||
: await DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).FirstAsync();
|
: await DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).FirstAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1548,10 +1450,10 @@ namespace CoreCms.Net.Repository
|
|||||||
{
|
{
|
||||||
if (whereLambda == null)
|
if (whereLambda == null)
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? DbBaseClient.Queryable(joinExpression).Select(selectExpression).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToList()
|
? DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToList()
|
||||||
: DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToList();
|
: DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToList();
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToList()
|
? DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToList()
|
||||||
: DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToList();
|
: DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1577,10 +1479,10 @@ namespace CoreCms.Net.Repository
|
|||||||
{
|
{
|
||||||
if (whereLambda == null)
|
if (whereLambda == null)
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? await DbBaseClient.Queryable(joinExpression).Select(selectExpression).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync()
|
? await DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync()
|
||||||
: await DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
: await DbBaseClient.Queryable(joinExpression).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
||||||
return blUseNoLock
|
return blUseNoLock
|
||||||
? await DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).With(SqlWith.NoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync()
|
? await DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithNoLockOrNot(blUseNoLock).WithCacheIF(isDataCache, cacheTimes).ToListAsync()
|
||||||
: await DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
: await DbBaseClient.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).WithCacheIF(isDataCache, cacheTimes).ToListAsync();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
19
CoreCms.Net.Repository/SqlSugarExtensions.cs
Normal file
19
CoreCms.Net.Repository/SqlSugarExtensions.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.Repository
|
||||||
|
{
|
||||||
|
internal static class SqlSugarExtensions
|
||||||
|
{
|
||||||
|
internal static ISugarQueryable<T> WithNoLockOrNot<T>(this ISugarQueryable<T> query, bool @lock = false)
|
||||||
|
{
|
||||||
|
if (@lock)
|
||||||
|
{
|
||||||
|
query = query.With(SqlWith.NoLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -581,7 +581,7 @@ namespace CoreCms.Net.Services
|
|||||||
var paymentRelData = new CheckPayDTO();
|
var paymentRelData = new CheckPayDTO();
|
||||||
|
|
||||||
var sourceStrArr = sourceStr.Split(",");
|
var sourceStrArr = sourceStr.Split(",");
|
||||||
if (sourceStrArr.Length > 0)
|
if (sourceStrArr.Length > 1)
|
||||||
{
|
{
|
||||||
var paymentRel = await BatchFormatPaymentRel(sourceStrArr, type, @params);
|
var paymentRel = await BatchFormatPaymentRel(sourceStrArr, type, @params);
|
||||||
if (paymentRel.status == false)
|
if (paymentRel.status == false)
|
||||||
|
|||||||
Reference in New Issue
Block a user