结构映射到Ninject规则

时间:2010-06-28 18:21:54

标签: structuremap ninject

如何在Ninject中编写此StructureMap行

        ForRequestedType<HttpContextBase>()
            .TheDefault.Is.ConstructedBy(x => new HttpContextWrapper(HttpContext.Current));

1 个答案:

答案 0 :(得分:5)

Bind<HttpContextBase>().ToMethod(context => new HttpContextWrapper(HttpContext.Current));