【发布时间】:2010-07-10 19:08:46
【问题描述】:
我是使用 ninject 2.0 的 ninject 新手。我的应用程序托管在 asp.net mvc 中。
现在我不知道如何访问在我的类库中创建的内核。
我认为我应该在 global.aspx 中创建内核并在其中加载所有模块。但是我怎样才能让它在整个应用程序中可用?
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
IKernel kernel = new StandardKernel(new ServiceModule());
}
上面创建的内核应该去哪里?以及如何访问它?
【问题讨论】:
标签: asp.net-mvc ninject ninject-2 common-service-locator