阅读背景:

如何将对象传递给windsor容器而不是类型?

来源:互联网 

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;
    }
}
public 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: