Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
services.AddDbContext<ApplicationDbContext>((serviceProvider, dbContextBuilder) =>
var connectionStringPlaceHolder = Configuration.GetConnectionString("PlaceHolderConnection");
var httpContextAccessor = serviceProvider.GetRequiredService<IHttpContextAccessor>();
var dbName = httpContextAccessor.HttpContext.Request.Headers["tenantId"].First();
var connectionString = connectionStringPlaceHolder.Replace("{dbName}", dbName);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.