Exemplo n.º 1
0
        public EFUnitOfWork(NaifDbContext dbContext, ICacheProvider cache)
        {
            Requires.NotNull(dbContext);
            Requires.NotNull(cache);

            _dbContext = dbContext;
            _cache     = cache;
        }
Exemplo n.º 2
0
        public EFUnitOfWork(string connectionString, Action <DbModelBuilder> modelCreateCallback, ICacheProvider cache)
        {
            Requires.NotNull(cache);
            Requires.NotNullOrEmpty("connectionString", connectionString);

            _dbContext = new NaifDbContext(connectionString, modelCreateCallback);
            _cache     = cache;
        }
Exemplo n.º 3
0
        public EFLinqRepository(IUnitOfWork unitOfWork, ICacheProvider cache) : base(cache)
        {
            Requires.NotNull("unitOfWork", unitOfWork);

            var efUnitOfWork = unitOfWork as EFUnitOfWork;

            if (efUnitOfWork == null)
            {
                throw new Exception("Must be EFUnitOfWork"); // TODO: Typed exception
            }
            _context = efUnitOfWork.DbContext();
            _dbSet   = _context.Set <TModel>();
        }