Ejemplo n.º 1
0
        public FavLocsData(
            IFavLocsDbContext dbContext,
            IEFRepository <Location> locationsRepo,
            IEFRepository <User> usersRepo,
            IEFRepository <Country> countriesRepo)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("Database context cannot be null.");
            }

            if (locationsRepo == null)
            {
                throw new ArgumentNullException("Locations repo cannot be null.");
            }

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

            if (countriesRepo == null)
            {
                throw new ArgumentNullException("Countries repo cannot be null.");
            }

            this.dbContext = dbContext;
            this.Users     = usersRepo;
            this.Locations = locationsRepo;
            this.Countries = countriesRepo;
        }
Ejemplo n.º 2
0
        public EFRepository(IFavLocsDbContext dbContext)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("Database context cannot be null");
            }

            this.dbContext = dbContext;
            this.dbSet     = this.dbContext.Set <T>();
        }