How do I connect to multiple database instances from a Blazor WebAssembly project, where I have also added the ASP.NET Core hosted?
My thought was to initiate the DBContexts
into the `Startup.cs`` (from Blazor.Server Application which has a reference to Blazor.Client Application):
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<DatabaseContext>(options =>
options.UseSqlite(
"connection string holder ..."));
}
like this but I want to let the user choose in my View if they want to do a test run of the App where the SQLite database instance will be created. The regular run will be an instance to SQL Server database. How can I do this in the ConfigureServices method?
Right now I am building the DBContexts
classes, are these effected too?
The controllers are not done yet, are ASP.NET Core MVC controllers the right choice?