saber mohamed

saber mohamed

  • 1.7k
  • 55
  • 898

Dot NET 6 API PRoject

Apr 6 2022 9:31 AM

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)