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
If you use the Microsoft ServiceLocator, you can apply the service locator design pattern and ask the container for the service.
In your case it would look something like this:
public partial class _Default : System.Web.UI.Page, IPostEditView {
PostEditController controller;
public _Default()
{
var service = ServiceLocator.Current.GetInstance();
this.controller = new PostEditController(this, service);
}
}
ServiceLocator has implementations for Castle Windsor and StructureMap. Not sure about Ninject, but it's trivial to create a ServiceLocator adapter for a new IoC.