Skip to main content
1 of 2
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.

Euphoric
  • 37.8k
  • 6
  • 81
  • 117