I have the following class:
public class ViewPage<TView,TPresenter> : Page
where TView : IView
where TPresenter : Presenter<TView>
{
public ViewPage()
{
if (!(this is TView))
throw new Exception(String.Format("The view must be of type {0}", typeof(TView)));
IWindsorContainer container = new WindsorContainer();
container.AddComponent("view", typeof(IView), typeof(TView));
container.AddComponent("presenter", typeof(Presenter<TView>), typeof(TPresenter));
TPresenter presenter = container[typeof(TPresenter)] as TPresenter;
}
}
and this is the Presenter code:
public class Presenter<T> where T : IView
{
public T View { get; private set; }
public Presenter(T view)
{
this.View = view;
}
}
I'd like to pass the current instance of ViewPage to TPresenter via Windsor instead of having it instantiate a new object. Is this possible?