views:

43

answers:

1

How to write this StructureMap line in Ninject

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

?

+1  A: 
Bind<HttpContextBase>().ToMethod(context => new HttpContextWrapper(HttpContext.Current));
Matt Casto
Delegate 'System.Func<Ninject.Activation.IContext,System.Web.HttpContextBase>' does not take 0 arguments
mare
@mare: Fixed typo
Ruben Bartelink
Ah, oops. I had used a lambda with zero arguments. Thanks for the edit Ruben.
Matt Casto