Exemple #1
0
 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);
 }
Exemple #2
0
        public EFRepository(BAProjeContext dbContext)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("Context bulunamadı!");
            }

            _dbContext = dbContext;
            _dbSet     = dbContext.Set <T>();
        }
Exemple #3
0
        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;
        }
Exemple #4
0
 public UserService(BAProjeContext dbContext) : base(dbContext)
 {
 }