My.RolePermission.BLL/BaseService.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using My.RolePermission.DALSessionFactory;
using My.RolePermission.IDAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace My.RolePermission.BLL
{
    public abstract class BaseService<T> where T : class,new()
    {
        public IDBSession GetCurrentDbSession
        {
            get
            {
                return DBSessionFactory.CreateDbSession();
            }

        }
        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();
        }
        public bool EditEntity(T entity)
        {
            CurrentRepository.EditEntity(entity);
后面还有 10 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。