c# - Is there a less verbose solution than using the Provider Factory pattern? -
When .NET 2.0 came out I was very impressed by the provider's factory pattern which was used for many services that 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
- to ensure me There was no good answer for how it can be ensured that there was never a good answer to ensure that both the stable manager had wrapped up all the methods of the provider: the provider could implement an interface, But interfaces on static methods C (AAAI) can not be used. Therefore there was always an opportunity to deviate between the wrapped provider and the stable manager.
- The quantity of boiler plate code was shot through the roof, and my productivity turned out to be the opposite floor, instead of just calling for example. Method ();
I was calling it, but through a stable manager. Dwarwerk, who was implementing his example of Dwarver (), which usually became a common code in ProviderBase class, who investigated ARG, did some work, and finally called an internal internal dorkwork () Which was applied in the custom class class ...
In other words ... one method (3 to 4 methods, check logs everywhere, where try / hold / log in manager or ProviderBase ? -ATC.
So, my question is: is there another Pattern that I can give config file configuration capabilities, allows dynamic changes - OK, at least on the service provider's restart?
PS: I recently introduced the IOC / DOI Heard in the form of a much faster solution ... though it was not used in production. It looks interesting ... but my first impression is that the DOI has switched services, config files in the config file Yes, but there is no setting for parameters from the config file?
Thanks!
If you want to search dependency injection, I would suggest or libraries some stack overflow questions, so just search and you will get a lot of information.
For your real question, it seems that instead of a provider, the model uses a model, it seems that it mapped more closely to new things coming out of Redmond. As it goes, like that.
Focusing on composition means that instead of a "relationship", a "relationship" between relationships between "relationships" has been designed as a design, they define less contract details Focus on doing and allow specific implementation, compelled construction routes (instead of using abstract methods), deal with the way to complete the contract, which is common in subtype-based design. And often there are drawbacks to both solutions in a solution-specific implementation towards more engineers (for example, the version is often cited as a challenge with a structure based design using the interface), so it depends on you You can do what you are doing.
In general, I think dependency injection is better for application code as writing your code, often by defining a harsh succession model, it coupled it tightly and usually tests the unit Makes code easier for In addition, many issues cited specifically with the structure are less important for the framework of the application (again, version). The truth is probably somewhere in the middle, as seen in MVC, where the reliance between components uses simple interfaces, but the base class implementing the general functionality only to the successor of the necessary bits and to override Are available.
This is the reason IOC's containers help here because they provide a loose coupled device for asking for a component, knowing nothing about the implementation, for example, DependencyResolver.GetInstanceOf & lt; IUserRepository & gt; ()
.
Comments
Post a Comment