仓储规范接口

 /// <summary>
    /// 基础的数据操作规范
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    public interface IRepository<TEntity>
        where TEntity : class
    {
        /// <summary>
        /// 添加实体(单个)
        /// </summary>
        /// <param name="entity">实体对象</param>
        void Add(TEntity entity);

        /// <summary>
        /// 批量插入实体(多个)
        /// </summary>
        /// <param name="list">实体列表</param>
        void Add(IList<TEntity> list);

        /// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="entits">实体对象</param>
        void Delete(params object[] entits);

        /// <summary>
        /// 更新实体(单个)
        /// </summary>
        /// <param name="entity">实体对象</param>
        void Update(TEntity entity);

        /// <summary>
        /// 更新实体(多个)
        /// </summary>
        /// <param name="entits">实体对象</param>
        void Update(IList<TEntity> entits);

        /// <summary>
        /// 获取默认可查询集
        /// </summary>
        /// <returns>默认可查询集</returns>
        IQueryable<TEntity> GetList();

        /// <summary>
        /// 获取单条实体
        /// </summary>
        /// <param name="id">主键id</param>
        /// <returns></returns>
        TEntity GetModelById(object id);

 

posted @ 2014-10-25 22:30  等待是一生最初的苍老  阅读(224)  评论(0编辑  收藏  举报