public string GetForCustomer() { var connectionStringTemplate = _configuration.GetConnectionString("Customer"); var customerId = _customerIdService.GetCustomerIdNotNull(); var connectionString = string.Format(connectionStringTemplate, customerId); return(connectionString); }
public Task <PersonalLegacyContext> CreateDbContext() { var db = $"PersonalLegacy_{_customerIdService.GetCustomerIdNotNull()}"; var optionsBuilder = new DbContextOptionsBuilder <PersonalLegacyContext>(); optionsBuilder.UseInMemoryDatabase(db); return(Task.FromResult(new PersonalLegacyContext(optionsBuilder.Options))); }
public Task <PersonalLegacyContext> CreateDbContext() { var connectionStringTemplate = _configuration.GetConnectionString(CONNECTIONSTRING_KEY); var connectionString = string.Format(connectionStringTemplate, _customerIdService.GetCustomerIdNotNull()); var optionsBuilder = new DbContextOptionsBuilder <PersonalLegacyContext>(); optionsBuilder.UseSqlServer(connectionString); return(Task.FromResult(new PersonalLegacyContext(optionsBuilder.Options))); }
public async Task <SticosWidgetDbContext> CreateDbContext() { var db = $"SticosWidgets_{_customerIdService.GetCustomerIdNotNull()}"; var optionsBuilder = new DbContextOptionsBuilder <SticosWidgetDbContext>(); optionsBuilder.UseInMemoryDatabase(db); var context = new SticosWidgetDbContext(optionsBuilder.Options); await Seed(context); return(context); }
public async Task Delete(int id) { var integration = await _repository.Delete(id); if (integration != null) { await _integrationDeletePublisher.Publish(new { integration.Id, integration.UnitId, integration.ExternalSystem, integration.Category, CustomerId = _customerIdService.GetCustomerIdNotNull() }); } }
public async Task <IntegrationDbContext> CreateDbContext() { var connectionString = string.Format(_configuration.GetConnectionString("Default"), _customerIdService.GetCustomerIdNotNull()); var optionsBuilder = new DbContextOptionsBuilder <IntegrationDbContext>(); optionsBuilder.UseSqlServer(connectionString); var context = new IntegrationDbContext(optionsBuilder.Options); await context.Database.MigrateAsync(); return(context); }
public PersonalLegacyContextFactoryBuilder WithCurrentCustomerId(int customerId) { A.CallTo(() => _customerIdService.GetCustomerIdNotNull()).Returns(customerId); return(this); }