Exemplo n.º 1
0
 public InitialDataSeeder(IApplicationWriteDbContext context, IApplicationWriteDbFacade facade, ILogger logger, IViewModelToDbEntityMapper <TenantViewModel, TenantEntity> tenantViewModelToDbEntityMapper)
 {
     this.context = context ?? throw new ArgumentNullException(nameof(context));
     this.facade  = facade ?? throw new ArgumentNullException(nameof(facade));
     this.logger  = logger ?? throw new ArgumentNullException(nameof(logger));
     this.tenantViewModelToDbEntityMapper = tenantViewModelToDbEntityMapper ?? throw new ArgumentNullException(nameof(tenantViewModelToDbEntityMapper));
 }
 public AddOrUpdateTenantCommandHandler(
     IApplicationWriteDbContext context,
     IApplicationWriteDbFacade facade,
     IViewModelToDbEntityMapper <TenantViewModel, TenantEntity> mapper)
 {
     this.context = context ?? throw new ArgumentNullException(nameof(context));
     this.facade  = facade ?? throw new ArgumentNullException(nameof(facade));
     this.mapper  = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
        public static string[] GetTenantTables(this IApplicationWriteDbFacade facade)
        {
            var tenantTables =
                (from prop in typeof(IApplicationWriteDbContext).GetProperties()
                 where prop.PropertyType.IsGenericType && prop.PropertyType.GetGenericTypeDefinition() == typeof(DbSet <>) &&
                 prop.PropertyType.GetGenericArguments()[0].GetProperties().Any(p => p.Name == "TenantId")
                 select prop.Name).ToArray();

            return((from t in tablesOrderedByRelation where tenantTables.Contains(t) select t).ToArray());
        }
Exemplo n.º 4
0
 public SubmitNewPaidTimeOffRequestCommandHandler(
     IApplicationWriteDbContext context,
     IApplicationWriteDbFacade facade,
     PaidTimeOffRequestService paidTimeOffRequestService,
     IModelMapper mapper)
 {
     this.context = context ?? throw new ArgumentNullException(nameof(context));
     this.facade  = facade ?? throw new ArgumentNullException(nameof(facade));
     this.mapper  = mapper ?? throw new ArgumentNullException(nameof(mapper));
     this.paidTimeOffRequestService = paidTimeOffRequestService ?? throw new ArgumentNullException(nameof(paidTimeOffRequestService));
 }
 public SeedInitialDataCommandHandler(
     IApplicationWriteDbContext context,
     IApplicationWriteDbFacade queryFacade,
     ILogger <SeedInitialDataCommandHandler> logger,
     IViewModelToDbEntityMapper <TenantViewModel, TenantEntity> tenantViewModelToDbEntityMapper)
 {
     this.context     = context ?? throw new ArgumentNullException(nameof(context));
     this.queryFacade = queryFacade ?? throw new ArgumentNullException(nameof(queryFacade));
     this.logger      = logger ?? throw new ArgumentNullException(nameof(logger));
     this.tenantViewModelToDbEntityMapper = tenantViewModelToDbEntityMapper ?? throw new ArgumentNullException(nameof(tenantViewModelToDbEntityMapper));
 }
Exemplo n.º 6
0
 public DummyDataInserter(IApplicationWriteDbContext context, IApplicationWriteDbFacade facade)
 {
     this.context = context ?? throw new ArgumentNullException(nameof(context));
     this.facade  = facade ?? throw new ArgumentNullException(nameof(facade));
 }
Exemplo n.º 7
0
 public ClearAndReinitializeAllDataCommandHandler(IApplicationWriteDbFacade queryFacade)
 {
     this.queryFacade = queryFacade ?? throw new ArgumentNullException(nameof(queryFacade));
 }
Exemplo n.º 8
0
 public ClearTablesCommandHandler(IApplicationWriteDbFacade facade)
 {
     this.facade = facade ?? throw new ArgumentNullException(nameof(facade));
 }
 public static Task TurnOnIdentityIncrementAsync(this IApplicationWriteDbFacade facade, string tableName, IDbTransaction?transaction = null)
 => facade.ExecuteAsync(GetIdentityIncrementStatement(tableName, false), transaction: transaction);
 public static Task SetIdentitySeedForAllAspNetCoreTablesAsync(this IApplicationWriteDbFacade facade, int seedValue, IDbTransaction?transaction = null)
 => facade.ExecuteAsync(string.Join(Environment.NewLine, from t in aspNetCoreTablesOrderedByRelation select GetReseedStatement(t, seedValue)), transaction: transaction);
 public static Task SetIdentitySeedAsync(this IApplicationWriteDbFacade facade, string tableName, int seedValue, IDbTransaction?transaction = null)
 => facade.ExecuteAsync(GetReseedStatement(tableName, seedValue), transaction: transaction);
 public static Task ClearAllTablesAsync(this IApplicationWriteDbFacade facade, IDbTransaction?transaction = null)
 => facade.ExecuteAsync(string.Join(Environment.NewLine, from t in tablesOrderedByRelation select GetDeleteStatement(t)), transaction: transaction);
Exemplo n.º 13
0
 public DeleteTenantCommandHandler(IApplicationWriteDbFacade facade, IApplicationWriteDbContext context)
 {
     this.facade  = facade ?? throw new ArgumentNullException(nameof(facade));
     this.context = context ?? throw new ArgumentNullException(nameof(context));
 }