title: MVP pattern using webforms and DI object instantiation
body: <p>I am using the generic repository pattern to persist my data.  On the PageLoad, I am creating a new Repository (from IRepository) object, and on PageUnload, I dispose of it.  </p>
  
  <p>Should the MasterPage/Page be in charge of instantiating the objects to pass to the presenter or should the presenter be in charge of this?  I'm more concerned with testing the presenter than the page (View) since it's easier to mock the interfaces passed to the presenter.  </p>
  
  <p><strong>Example Page</strong></p>
  
  <pre><code>public partial class _Default : System.Web.UI.Page
  {
      private IRepository _repo;
      protected void Page_Load(object sender, EventArgs e)
      {
          if (_repo == null)
              _repo = new Repository();
          ConnectPresenter();
      }
  
      private void ConnectPresenter()
      {
          _DefaultPresenter presenter = new _DefaultPresenter(_repo);
      }
  
      private void Page_Unload(object sender, EventArgs e)
      {
          if (_repo != null)
              _repo.Dispose();
      }
  }
  </code></pre>
  
  <p>Would a DI Framework such as StructureMap or Ninject help in this case?  Would it be in charge of disposing objects such as this? </p>