MVC项目结构搭建及单个类的实现学习笔记1

2019-05-22 08:50:41王旭

IBaseService接口:

using System;
using System.Linq;
using System.Linq.Expressions;
using PMS.IDAL;

namespace PMS.IBLL
{
  public interface IBaseService<T> where T : class,new()
  {
    IDbSession CurrentDbSession { get; }
    IBaseDal<T> CurrentDal { get; set; }
    void SetCurrentDal();
    IQueryable<T> LoadEntities(Expression<Func<T, bool>> whereLambda);

    IQueryable<T> LoadPageEntities<s>(int pageIndex, int pageSize, out int totalCount,
      Expression<Func<T, bool>> whereLambda,
      Expression<Func<T, s>> orderbyLambda, bool isAsc);

    bool DeleteEntity(T entity);
    bool EditEntity(T entity);
    T AddEntity(T entity);
  }
}

IUserService接口:

using PMS.Model;

namespace PMS.IBLL
{
  public partial interface IUserService:IBaseService<User>
  {

  }
}

使用UserService类实现IUserService接口:

public partial class UserService : BaseService<User>, IUserService  

以上我们就完成了整个框架中关于User类的各层次的实现。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易采站长站。