RolePermission.Bll/BaseService.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using RolePermission.IDAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace RolePermission.BLL
{
public abstract class BaseService<T> where T : class, new()
{
protected readonly IDBSession dbSession;
public IDBSession GetCurrentDbSession => dbSession;
public BaseService(IDBSession session)
{
dbSession = session;
SetCurretnRepository();
}
public IDAL.IBaseRepository<T> CurrentRepository { get; set; }
public abstract void SetCurretnRepository();
// public BaseService()
// {
// SetCurretnRepository();
// }
/// <summary>
/// 查询
/// </summary>
/// <param name="whereLambda"></param>
/// <returns></returns>
public IQueryable<T> LoadEntities(Expression<Func<T, bool>> whereLambda)
{
return CurrentRepository.LoadEntities(whereLambda);
}
/// <summary>
/// 实现对数据的分页查询
/// </summary>
/// <typeparam name="model">实体对象</typeparam>
/// <param name="pageIdex">页码</param>
/// <param name="pageSize">每页显示记录数</param>
/// <param name="toalCount">总记录数</param>
/// <param name="whereLambda">条件表达式</param>
/// <param name="orderby">排序字段</param>
/// <param name="isAsc">是否升序(true:表示升序, false:降序)</param>
/// <returns></returns>
public IQueryable<T> LoadPageEntities<s>(int pageIdex, int pageSize, out int toalCount,
Expression<Func<T, bool>> whereLambda, string orderby, bool? isAsc)
{
return CurrentRepository.LoadPageEntities<s>(pageIdex, pageSize, out toalCount, whereLambda, orderby,
isAsc);
}
public bool DeleteEntity(T entity)
{
CurrentRepository.DeleteEntity(entity);
return this.GetCurrentDbSession.SaveChanges();
}
后面还有 15 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。