码迷,mamicode.com
首页 > 数据库 > 详细

ASP.NET MVC EF 02 数据库访问层的设计

时间:2016-04-03 17:21:24      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:

1、接口(IBaseRepository(仓储))操作数据库(增删改查),代码如下:

    /// <summary>
    /// 基仓储实现的方法
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IBaseRepository<T> where T : class,new()
    {
        //添加
        T AddEntities(T entity);

        //修改
        bool UpdateEntities(T entity);

        //删除
        bool DeleteEntities(T entity);

        //查询
        IQueryable<T> LodeEntities(Func<T, bool> wherelambda);

        //分页
        IQueryable<T> LoadPagerEntities<S>(int pageSize, int pageIndex,
            out int total, Func<T, bool> wherelambda, bool isAsc, Func<T, S> orderByLambda);
    }

 

 

  

  

ASP.NET MVC EF 02 数据库访问层的设计

标签:

原文地址:http://www.cnblogs.com/jiayahui/p/5350080.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!