我想用一个惰性求值的参数绑定我的控制器。
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
{
try
{
return controllerType == null
? null
: (IController) _ninjectKernel.Get(controllerType);
}
catch (Exception ex)
{
throw;
}
}
我有下一个绑定:
_ninjectKernel.Bind<IFilesRepository>().To<FilesManager>().WithConstructorArgument("storageFolderAbsolutePath", c => c.ToString());
问题出在 lambda 函数上。我想返回 Server.MapPath("/") ...但我在 c 对象中没有请求上下文。我怎样才能发送它?