public TestController(BAProjeContext dbContext) { _dbContext = dbContext; _uow = new EFUnitOfWork(_dbContext); _categoryRepository = new EFRepository <Category>(_dbContext); //Veya alttaki gibi bir logic kurulabilir: _userRepository = new UserService(dbContext); }
public EFRepository(BAProjeContext dbContext) { if (dbContext == null) { throw new ArgumentNullException("Context bulunamadı!"); } _dbContext = dbContext; _dbSet = dbContext.Set <T>(); }
public EFUnitOfWork(BAProjeContext dbContext) { if (dbContext == null) { throw new ArgumentNullException("Context bulunamadı!"); } _dbContext = dbContext; //Bu noktada lazy loading vb işlemler eklenebilir. //Eski kod: //_dbContext.Configuration.LazyLoadingEnabled = false; //Yeni Kod: //_dbContext.ChangeTracker.LazyLoadingEnabled = false; }
public UserService(BAProjeContext dbContext) : base(dbContext) { }