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);

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
  • 2021-09-25
  • 2021-04-20
猜你喜欢
  • 2022-02-25
  • 2021-07-30
  • 2021-10-11
  • 2021-09-01
  • 2021-11-09
  • 2022-02-06
  • 2022-12-23
相关资源
相似解决方案