I wanted to check in program.cs "force" after "builde", when the application is loaded, if it is local (127.0.0.1), it will use the local database (LocalConnection), and if it is a server, it will use the server database(DefaultConnection).
(It is not useful for me after app and only after build needed)
var builder = WebApplication.CreateBuilder(args);
var connectionString="";
bool isLocal= ...?<<<<<<<<<<<<?
if (isLocal)
{
var connectionString0 = builder.Configuration.GetConnectionString("LocalConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
connectionString = connectionString0;
}
else
{
var connectionString0 = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
connectionString = connectionString0;
}
...
var app = builder.Build();
//It is not useful for me after app.
...
pls befor answer that, check your solution in blazor web app 8.0 only, tnks.
not working: