I have an ASP.NET page that implements my view and creates the presenter in the page constuctor. Phil Haack\'s post providing was used as the starting point, and I\'ll just
In our homegrown MVP-framework we had a typed base-class that all Pages inherited from. The type needed to be of type Presenter (our base presenter class)
In the base-class we then initialized the controller using the IoC-container.
Sample code:
public class EditPage : BasePage {
}
public class EditController : Presenter {
public EditController(IService service) { }
}
public class BasePage : Page where T: Presenter
{
T Presenter { get; set; }
public BasePage() {
Presenter = ObjectFactory.GetInstance(); //StructureMap
}
}
Hope this helps!