首页 > 数据库技术 > 详细

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

时间:2016-04-03 17:18:32      阅读:313      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!