0
傳遞參數,接口類我有一個類來保存這樣在ninject
public class SessionService : ISession
{
public HttpContext Context { get; set; }
public SessionService(HttpContext context)
{
this.Context = context;
}
}
我希望能夠注入會話對象在我MVC3應用程序不同的地方會議。 我有這個接口
interface ISession
{
HttpContext Context { get; set; }
}
我使用ninject到會話類綁定接口這樣
private void RegisterDependencyResolver()
{
var kernel = new StandardKernel();
kernel.Bind<ISession>().To<SessionService>();
DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
}
我的問題是如何的HttpContext參數傳遞到SessionService構造。
任何最受讚賞的指針。
感謝
可能重複的[注入的HttpContext中Ninject 2](http://stackoverflow.com/questions/3617447/injecting-httpcontext-in-ninject-2) – CAbbott