Search code examples
c#unity-container

Auto-Resolution of Constructor parameters from Unity Container


I would like to create an app where it would auto-magically resolve all my constructor parameters using a unity container. Does anyone have an example on how to accomplish this?

I saw this being done when using Owin but I'm not sure how to whip up something similar for use in any application that I build. Any pointers?


Solution

  • All constructor parameters as in "all constructors that are ever called" is a heavy requirement. Assuming a desktop application: you can get close if you go for Prism with Unity and use the ViewModelLocator to create your view models.