i have 3 connection string with 3 dbcontext
my quetion how to change connetion string manual thorw api endpoind from dev connetion to qas or prod connetion
var pro = builder.Configuration.GetConnectionString(“Prod”); builder.Services.AddDbContextPool
//------
var qas = builder.Configuration.GetConnectionString("Qas"); builder.Services.AddDbContextPool
//------ var dev = builder.Configuration.GetConnectionString(“Dev”); builder.Services.AddDbContextPool
//------
Anupam MaitiPosted Apr 26, 2022, 6:15 AM
Do you have 3 different set of connection strings for same env? If it is mutiple env , then I would suggest to create 3 different set of appsettings.json file based on enviroment like dev.appsettings.json , qa.appsettings.json etc. then in Program.cs read it like below -
Sachin SinghPosted Apr 6, 2022, 10:52 AM
ASPNETCORE_ENVIRONMENT");