Ejemplo n.º 1
0
        public string GetForCustomer()
        {
            var connectionStringTemplate = _configuration.GetConnectionString("Customer");

            var customerId       = _customerIdService.GetCustomerIdNotNull();
            var connectionString = string.Format(connectionStringTemplate, customerId);

            return(connectionString);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 5
0
        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()
                });
            }
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
 public PersonalLegacyContextFactoryBuilder WithCurrentCustomerId(int customerId)
 {
     A.CallTo(() => _customerIdService.GetCustomerIdNotNull()).Returns(customerId);
     return(this);
 }