Use in Web App/Web Service App

Feb 19, 2008 at 8:51 AM
Just trying to get my head around Unity.

For Windows Forms the quickstart implies you need this...


If this is vital to ensuring that MainForm then uses dependency injection, how do I ensure the same for my web application (which clearly doesn't have a main form in this sense)
Feb 19, 2008 at 1:38 PM
In MVC, you'll want a new ControllerFactory. David has great post regarding this here:

In regular WebForms, Unity supports to inject an already create object using BuildUp<T>.

Therefore, somewhere down the event chain (Page_Load being one), you could do: