need an alternative to the provider pattern -


I maintain a web application using the provider pattern described below for configuration purposes


Everything is working fine, but as we add functionality to our application, we are aware that our providers have become mash with many different tasks together . We are considering to split the configuration provider so that the function is organized with other functions such as We are doing this because our original provider has a lot of functions which are not required to be implemented by some modules. Instead of throwing NotImplementedException on external functions while implementing the provider, we would not want to include them.

We know that we can create multiple providers using the above mentioned MSDN method, but many providers of the web Make more entries in config. It would be good to reduce entries in web.config, as it is growing up

Has there been any other way to implement the provider model?

You can see the container of control (IOC) (Google "Castle Windsor", or structural map, or AutoFac, or NINJject, or Microsoft Unity). Using IoC You can configure either "configuration" in the configuration file or at the beginning of your application.

Usually you create an interface for each type of provider that you have. By using the interface you can easily break your providers, but it did understand you.

Once you have an interface, you can simply ask the container for the implementation of that interface when it is required and the container will take care of making the provider instant for you


Comments