I am developing an asp.net web application and I am using ASP.NET Membership Provider. The application uses the membership scheme and all the necessary objects in the main database of the application. However, during development I have to switch to different databases for different development and testing scenarios. To do this, I have a file for the external connection strings section, as well as an external appsettings section, which allows me not to change the main web.config, but itβs easy to switch db by changing the settings only in the appsettings section.
My files:
<connectionStrings configSource="connections.config">
</connectionStrings>
<appSettings file="local.config">
....
ConnectionStrings looks as usual:
<connectionStrings>
<add name="MyDB1" connectionString="..." ... />
<add name="MyDB2" connectionString="..." ... />
....
</connectionStrings>
And local.config as below
<appSettings>
<add key="ConnectionString" value="MyDB2" />
My code takes this connection string into account
web.config ,
<add name="MembershipProvider" connectionStringName="MyDB2" ...>
....
<add name="RoleProvider" connectionStringName="MyDB2" ...>
- , , db.
- appsetting db- db? "" ? , , - (, local.config)
, asp.net intio , , , , asp.net .