If I have a presenter like this -
public class LandingPresenter : ILandingPresenter
{
private ILandingView _view { get; set; }
private IProductService _productService { get; set; }
public LandingPresenter(ILandingView view, IProductService)
{
....
}
}
How do I register this Presenter with Autofac considering the dependent view will not be registered (but IProductService will)
builder.RegisterType<LandingPresenter>().As<ILandingPresenter>(); ????
Why not register the views in the container as well, put Autofac to work! Then you can hook up presenters and views automagically by using constructor injection on the presenters and property injection on the views. You just have to register the views with property-wiring:
Presenter:
View:
And if you want to go view-first then you should be able to reverse it so the presenters take the view as property instead.