public WidgetController(IConfiguration configuration, IHttpContextAccessor httpContextAccessor) { var tenantId = httpContextAccessor.HttpContext.User.Identity.Name; var settings = new TenantSettings { TenantId = tenantId, // get default cn from appsettings.json DefaultConnectionString = configuration.GetConnectionString("DefaultConnection") }; // build a DbContext specifically for this tenant var options = CreateDbContextOptionsBuilder(settings); _context = new WidgetDbContext(options); // seed data for the tenant SeedTestData(settings); }