Skip to main content
added 325 characters in body
Source Link
Euphoric
  • 37.8k
  • 6
  • 81
  • 117

Your solution is exactly how this problem should be solved. And it truly is called a Factory. Yes, things get somehow messy when lots of dependencies are involved.

Some more advanced IoC containers, like Unitylike Unity, can create these kind of factories automagically. Well, according to Unity auto-factory with params , only Autofac can really do that out-of-the box. While Unity can do it, the setup seems to be not much different from defining your own class in terms of amount of code and complexity.

Your solution is exactly how this problem should be solved. Yes, things get somehow messy when lots of dependencies are involved.

Some more advanced IoC containers, like Unity, can create these kind of factories automagically.

Your solution is exactly how this problem should be solved. And it truly is called a Factory. Yes, things get somehow messy when lots of dependencies are involved.

Some more advanced IoC containers, like Unity, can create these kind of factories automagically. Well, according to Unity auto-factory with params , only Autofac can really do that out-of-the box. While Unity can do it, the setup seems to be not much different from defining your own class in terms of amount of code and complexity.

Source Link
Euphoric
  • 37.8k
  • 6
  • 81
  • 117

Your solution is exactly how this problem should be solved. Yes, things get somehow messy when lots of dependencies are involved.

Some more advanced IoC containers, like Unity, can create these kind of factories automagically.