C# MVP Autofac和控制器

C# MVP Autofac和控制器,c#,mvp,autofac,C#,Mvp,Autofac,我有这样一页- public partial class ProductDetailMixed : SessionPage, IProductDetailMixedView { public IProductService ProductService { get; set; } protected void Page_Load(object sender, EventArgs e) { Controller = new

我有这样一页-

public partial class ProductDetailMixed : SessionPage, IProductDetailMixedView
{
        public IProductService ProductService { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            Controller = new ProductDetailMixedController(this, ProductService);

            OnLoadPage();
        }

        public event LoadPageEvent OnLoadPage;

        public IProductDetailMixedController Controller { get; set; }
}
Controller = new ProductDetailMixedController(this);
我有属性注入,所以IPProductService的实例将被注入到页面中,但是我真正想要的是像这样创建控制器-

public partial class ProductDetailMixed : SessionPage, IProductDetailMixedView
{
        public IProductService ProductService { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            Controller = new ProductDetailMixedController(this, ProductService);

            OnLoadPage();
        }

        public event LoadPageEvent OnLoadPage;

        public IProductDetailMixedController Controller { get; set; }
}
Controller = new ProductDetailMixedController(this);

然后ProductDetailMixedController的构造函数将只注入所有剩余的参数。。但是我该怎么做呢?在引用的示例中,演示者/控制器工厂还需要服务接口的参数。一旦有了这样的东西,您就可以从视图中删除服务的属性注入(当然,除非您在视图中使用它).

我完全按照指定的方式连接视图,并收到此错误-在类型“Cell.Common.Controllers.LandingController”上找不到任何具有“Public binding flags”的构造函数,可以使用可用的服务和参数调用:无法解析构造函数“Void.ctor”的参数“Cell.Common.Views.Landing.ILandingView”(Cell.Common.Views.Landing.ILandingView,Cell.Services.Catalog.IContentService,…。似乎Autofac不知道如何处理视图如何解决这个问题??我很抱歉……我不熟悉Autofac作为IoC容器。话虽如此,下面是另一个可能对这个主题有所帮助的示例:。这行代码:builder.Register().As().FactoryScope();无法注册,因为它依赖于尚未注册的视图。。。。