I'm writing a C# .NET module and I would like to use the provider pattern.
If my code is running on a web server, I have access to System.Web.Configuration
and can call ProvidersHelper
to load an appropriate provider as determined by the web.config
data.
If my code is running in a stand-alone environment, I won't have access to this class.
It seems to me that I might write a wrapper class that uses reflection to (a) determine if I can get to the built in System.Web.Configuration.ProvidersHelper
, and if not, (b) provide a functionally equivalent interface that would rely only on the resources I have available in the stand-alone mode.
Has anyone out there come across this issue before and/or have suggestions?