//这是刚开始写法,后面一步一步重构 //private BaseRepository<Category> _baseRepository; //private CategoryRepository _categoryRepository; //private InterfaceBaseRepository<Category> _categoryRepository; //public InterfaceCategoryService _interfaceCategoryService; //public CategoryService(DbContext dbContext) //public CategoryService(InterfaceBaseRepository<Category> baseRepository) public CategoryService(InterfaceBaseRepository <Category> interfaceBaseRepository) : base(interfaceBaseRepository) { // _baseRepository = new BaseRepository<Category>(dbContext); // _categoryRepository = new CategoryRepository(dbContext); //_categoryRepository = new BaseRepository<Category>(dbContext); //_categoryRepository = baseRepository; //_interfaceCategoryService = interfaceCategoryService; }
public BaseService(InterfaceBaseRepository <T> currentRepository) { CurrentRepository = currentRepository; }
public BaseService(InterfaceBaseRepository <T> interfaceBaseRepository) { _interfaceBaseRepository = interfaceBaseRepository; }
public CategoryService(InterfaceBaseRepository <Category> baseRepository) { _baseRepository = baseRepository; }
public BaseService() { this._repo = new BaseRepository <TEntity>(); }