Various db connections for controller in multiple scopes
I have an MVC5 application that has 2 areas: area1 and area2 I would like to access 2 different db connections for each area. I tried adding area1 \ Views \ web.config
<add name="DefaultConnection_area1" providerName="System.data.SqlClient" connectionString="Data Source=xxx;Initial Catalog=DB_AREA1;Integrated Security=true;MultipleActiveResultSets=True" />
and add AREA2 \ Views \ web.config
<add name="DefaultConnection_area2" providerName="System.data.SqlClient" connectionString="Data Source=xxx;Initial Catalog=DB_AREA2;Integrated Security=true;MultipleActiveResultSets=True" />
But i cant get DefaultConnection_area1 / 2 in area1 / 2 controllers via
ConfigurationManager.ConnectionStrings["DefaultConnection_area1(or 2)"].ConnectionString.
The only thing I can get is the connection string from the root Web.config
+3
source to share
No one has answered this question yet
See similar questions:
or similar: