For example, I created a provider service that uses a database. In web.config, how do I set the provider’s connection string to the main application connection string, defined in <ConnectionStrings>?
For example, I created a provider service that uses a database. In web.config, how
Share
Matt‘s answer is pretty much there, with a couple of tweaks.
If you’re happy to have it outside of the configuration code itself, once you’ve picked up your provider configuration, you can just talk to the main connection strings section directly from your provider classes:
If you want to wrap it all up in the provider you’ll need a backing field for your properties: