• EsayUI + MVC + ADO.NET(仓储基础接口)


      1.RepositoryFramework(仓储接口:无外乎就是CRUD)

      1.IAddRepository(添加接口) 

    using System;
    
    namespace Notify.Infrastructure.RepositoryFramework
    {
        /// <summary>
        /// IAddRepository{Add单条数据的接口}
        /// </summary>
        /// <typeparam name="T">T</typeparam>
        public interface IAddRepository<in T> : IDisposable
        {
            /// <summary>
            /// Add
            /// </summary>
            /// <param name="entity">entity</param>
            /// <returns>返回结果</returns>
            void Add(T entity);
        }
    }

      2.IUpdateRepository(修改接接口)

    using System;
    
    namespace Notify.Infrastructure.RepositoryFramework
    {
        /// <summary>
        ///  IUpdateRepository{更新接口}
        /// </summary>
        /// <typeparam name="T">T</typeparam>
        public interface IUpdateRepository<in T> : IDisposable
        {
            /// <summary>
            /// Update
            /// </summary>
            /// <param name="entity">entity</param>
            /// <returns>返回结果</returns>
            void Update(T entity);
        }
    }

          3.IQueryRepository(查询接口)

      

    using System;
    
    namespace Notify.Infrastructure.RepositoryFramework
    {
        /// <summary>
        /// IQueryRepository{根据主键查询接口}.
        /// </summary>
        /// <typeparam name="TValue">实体</typeparam>
        public interface IQueryRepository<out TValue> : IDisposable
        {
            /// <summary>
            /// Query
            /// </summary>
            /// <param name="id">id</param>
            /// <returns>返回查询单条数据</returns>
            TValue Query(object id);
        }
    
        /// <summary>
        /// IQueryRepository{根据主键查询接口}.
        /// </summary>
        /// <typeparam name="TKey">Tkey</typeparam>
        /// <typeparam name="TValue">实体</typeparam>
        public interface IQueryRepository<in TKey,out TValue> : IDisposable
        {
            /// <summary>
            /// Query
            /// </summary>
            /// <param name="key">id</param>
            /// <returns>返回查询单条数据</returns>
            TValue Query(TKey key);
        }
    }

      4.IRemoveRepository(删除接口)

    using System;
    
    namespace Notify.Infrastructure.RepositoryFramework
    {
        /// <summary>
        /// IRepository{删除接口}
        /// </summary>
        /// <typeparam name="T">TKey</typeparam>
        public interface IRemoveRepository<in T> : IDisposable
        {
            /// <summary>
            /// Remove
            /// </summary>
            /// <param name="entity">T</param>
            /// <returns>返回结果</returns>
            void Remove(T entity);
        }
    }

          5.IRepository(仓储接口 CRUD汇总)

    using Notify.Infrastructure.DomainBase;
    
    namespace Notify.Infrastructure.RepositoryFramework
    {
        /// <summary>
        /// 仓储接口(CRUD)
        /// </summary>
        /// <typeparam name="TValue">实体</typeparam>
        public interface IRepository<TValue> : IAddRepository<TValue>, IRemoveRepository<TValue>, IUpdateRepository<TValue>, IQueryRepository<TValue> where TValue : IEntity
        {
        }
    
        /// <summary>
        /// 仓储接口(CRUD)
        /// </summary>
        /// <typeparam name="TKey">主键</typeparam>
        /// <typeparam name="TValue">实体</typeparam>
        public interface IRepository<in TKey, TValue> : IAddRepository<TValue>, IRemoveRepository<TValue>, IUpdateRepository<TValue>, IQueryRepository<TKey, TValue> where TValue : IEntity
        {
        }
    }

       上篇--项目架构

       下篇--工作单元

  • 相关阅读:
    WPF 之Converter
    silverlight中 ComboBox绑定数据库,并获取当前选定值
    ComboBox联动 (AJAX BS实现)
    [推荐]Silverlight 2 开发者海报
    非常精彩的Silverlight 2控件样式
    一步一步学Silverlight 2系列文章
    POSIX 线程详解(经典必看)
    嵌入式 vlc从接收到数据流到播放视频的过程分析(经典)
    OpenGL ES教程系列(经典合集)
    Audio Queue Services Programming Guide(音频队列服务编程指南)
  • 原文地址:https://www.cnblogs.com/liuxiaoji/p/4997049.html
Copyright © 2020-2023  润新知