zoukankan      html  css  js  c++  java
  • MVC+LINQToSQL的Repository模式之(五)BLL层实现IOC

    namespace Service
    {
        public class Service<TEntity> : IService<TEntity> where TEntity : class,Entity.IEntity
        {
            private IRepository<TEntity> iRepository = null;
            public Service()
            {
                iRepository = new Repository<TEntity>();
            }
            #region IService<TEntity> 成员

            public TEntity GetModelById(params object[] keyValues)
            {
                return iRepository.Find(keyValues);
            }

            #endregion
        }
    }

    UI层调用的代码如下:

    Service.Service<Entity.TEST.UserBases> iService = new Service.Service<Entity.TEST.UserBases>();
               Console.WriteLine(iService.GetModelById("6").Name);

  • 相关阅读:
    个人工作量
    个人作业
    本周psp
    典型用户和场景总结
    排球比赛计分规则功能说明书
    我与计算机
    个人作业
    《怎样成为一个高手》读后感
    第十八周个人作业
    第十六周 项目耗时记录
  • 原文地址:https://www.cnblogs.com/lori/p/2241035.html
Copyright © 2011-2022 走看看