public EFUnitOfWork(NaifDbContext dbContext, ICacheProvider cache) { Requires.NotNull(dbContext); Requires.NotNull(cache); _dbContext = dbContext; _cache = cache; }
public EFUnitOfWork(string connectionString, Action <DbModelBuilder> modelCreateCallback, ICacheProvider cache) { Requires.NotNull(cache); Requires.NotNullOrEmpty("connectionString", connectionString); _dbContext = new NaifDbContext(connectionString, modelCreateCallback); _cache = cache; }
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>(); }