Hi:
When .NET 2.0 came out I was very impressed by the Provider Factory pattern used for several of the services that were rolled out at that time...and started using it everywhere.
But then I ran into real troubles with it:
- On CE, there was no config system, so it couldn't easily be ported to that environment (and therefore causing serious forks in code that could have otherwised worked on nicely on both frameworks with only a couple of modifications)
- I never found a good answer to how to ensure that both the static Manager had wrapped all the methods of the Providers: the providerBase could implement an Interface, but interfaces (AFAIK) can't be used on static methods. So there was always a chance of divergence between the wrapped provider, and the static manager.
- The amount of boiler plate code shot through the roof, and my productivity inversly dropped through the floor. By that I mean that instead of just calling instance.Method();
I was calling that, but through a static Manager.DoWork(), which was invoking its instance's DoWork(), which usually ended up being common code in the ProviderBase class, which checked the args, did some work, and finally called an abstract InternalDoWork(), which was implemented in the CustomProvider class...
In other words...a very tortuous way of invoking a method (3 to 4 methods, argument checking everywhere, unclarity of where to try/catch/log - in Manager or ProviderBase? -etc.
So, my question is: is there another pattern(s) that I can look at to give config file configuration capabilities, allowing dynamic changing -- well, atleast at restart -- of the service provider?
PS: I've heard much about IoC/DOI lately as being a possibly faster solution...although not used it in production. It looks interesting...But my first impression is that DOI seems to have the swapping of services, configurable in the config file, but not the setting of parameters from the config file?
Thanks!