2
Answers

Dot NET 6 API PRoject

saber mohamed

saber mohamed

2y
929
1

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<ProdContext>(options => options/*.UseLazyLoadingProxies()*/.UseSqlServer(connection));

//------

var qas = builder.Configuration.GetConnectionString("Qas"); builder.Services.AddDbContextPool<QasContext>(options => options/*.UseLazyLoadingProxies()*/.UseSqlServer(connection));

//------ var dev = builder.Configuration.GetConnectionString(“Dev”); builder.Services.AddDbContextPool<DevContext>(options => options/*.UseLazyLoadingProxies()*/.UseSqlServer(connection));

//------

 

Answers (2)