示例#1
0
        public EntityFrameworkRepository(IShishaTimeDbContext dbContext)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("DbContext cannot be null.");
            }

            this.dbContext = dbContext;
            this.dbSet     = this.dbContext.Set <T>();
        }
        public ShishaTimeData(
            IShishaTimeDbContext dbContext,
            IEntityFrameworkRepository <ShishaBar> barsRepository,
            IEntityFrameworkRepository <User> usersRepository,
            IEntityFrameworkRepository <Region> regionsRepository,
            IEntityFrameworkRepository <Review> reviewsRepository,
            IEntityFrameworkRepository <Rating> ratingsRepository)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("DbContext cannot be null.");
            }

            if (barsRepository == null)
            {
                throw new ArgumentNullException("Bars repository cannot be null.");
            }

            if (usersRepository == null)
            {
                throw new ArgumentNullException("Users repository cannot be null.");
            }

            if (regionsRepository == null)
            {
                throw new ArgumentNullException("Regions repository cannot be null.");
            }

            if (reviewsRepository == null)
            {
                throw new ArgumentNullException("Reviews repository cannot be null.");
            }

            if (ratingsRepository == null)
            {
                throw new ArgumentNullException("Ratings repository cannot be null.");
            }

            this.dbContext = dbContext;
            this.Bars      = barsRepository;
            this.Users     = usersRepository;
            this.Regions   = regionsRepository;
            this.Reviews   = reviewsRepository;
            this.Ratings   = ratingsRepository;
        }