Esempio n. 1
0
 public Repository(
     AccountsDbContext dbContext,
     Layer.Options layerOptions,
     Func <IUserIdAccessor> userIdAccessorGetter,
     IChangeTrackingFlags flags)
 {
     _dbContext = dbContext;
     _dbSet     = (DbSet <TEntity>)(_dbContext
                                    .GetType()
                                    .GetProperties()
                                    .Where(p => typeof(DbSet <TEntity>).IsAssignableTo(p.PropertyType))
                                    .Single()
                                    .GetValue(dbContext) ?? throw new ApplicationException("DB context not populated"));
     _layerOptions         = layerOptions;
     _userIdAccessorGetter = userIdAccessorGetter;
     _flags = flags;
 }
Esempio n. 2
0
 public UnitOfWork(AccountsDbContext dbContext, IChangeTrackingFlags flags)
 {
     _dbContext = dbContext;
     _flags     = flags;
 }