public DbContextUnitOfWorkRepository(IDbContextUnitOfWork context)
        {
            Guard.ArgumentIsNotNull(context, "context");

            _context = context;
            _dbSet   = context.Context.Set <T>();
        }
Beispiel #2
0
 public EfRepository(IDbContextUnitOfWork unitOfWork)
 {
     UnitOfWork       = unitOfWork;
     _context         = unitOfWork.GetContext(ReadConsistency.Strong);
     _readOnlyContext = unitOfWork.GetContext(ReadConsistency.Weak);
     _dbSet           = _context.Set <T>();
     _readOnlydbSet   = _readOnlyContext == _context ? _dbSet : _readOnlyContext.Set <T>();
 }
Beispiel #3
0
        public DbContextAutoMapperRepository(IDbContextUnitOfWork context)
        {
            Guard.ArgumentIsNotNull(context, "context");

            _context = context;
            _dbSet   = context.Context.Set <TEntity>();
            _dtoList = _dbSet.Select(i => Mapper.Map <TEntity, TDto>(i)).ToList();

            Mapper.CreateMap <TEntity, TDto>();
        }
Beispiel #4
0
 public void DbContextUnitOfWorkConstructorNullTest()
 {
     _unitOfWork = new DbContextUnitOfWork(null);
 }
Beispiel #5
0
 public void TestInitialize()
 {
     _context    = new Mock <DbContext>().Object;
     _unitOfWork = new DbContextUnitOfWork(_context);
 }
Beispiel #6
0
 public EfEntityRepository(IDbContextUnitOfWork unitOfWork) : base(unitOfWork)
 {
 }
Beispiel #7
0
 public void TestInitialize()
 {
     _context    = new Mock <DbContext>().Object;
     _unitOfWork = new DbContextUnitOfWork(_context);
     _repository = new DbContextUnitOfWorkRepository <Mock <string> >(_unitOfWork);
 }