什么是配置Ninject为MVC3应用程序的正确方法? [英] What's the proper way to configure Ninject for an MVC3 application?

查看:175
本文介绍了什么是配置Ninject为MVC3应用程序的正确方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读过关于Ninject的设置为MVC3项目的文章。

I've read several articles regarding the setup of Ninject for MVC3 projects.

有人说,你的Global.asax.cs应该继承的 NinjectHttpApplication 后,他人注册模块施工时在 StandardKernel 通过的Application_Start()。

Some say that your Global.asax.cs should inherit from NinjectHttpApplication, others register modules when constructing the StandardKernel via Application_Start().

我个人用的NuGet,它出了一个不同的方式创建一个 AppStart_NinjectMVC3 类,并开始使用它

I personally used NuGet and it went a different way creating a AppStart_NinjectMVC3 class, and starting it up using

[assembly: WebActivator.PreApplicationStartMethod(typeof(MyApp.AppStart_NinjectMVC3), "Start")]

有什么好处/坏处每?

Are there any advantages/disadvantages to each?

推荐答案

伊恩和我一直比较忙就在最近几天,这个话题。 Ninject.Web.Mvc Ninject.MVC3 已经合并。还是有两种方式无论是从 NinjectHttpApplication 或安装的NuGet包派生。但现在,他们都基于同一个code,使它们具有相同的功能。看到我的博文有关的更多详细信息:

Ian and I have been quite busy regarding this topic during the last few days. Ninject.Web.Mvc and Ninject.MVC3 have been merged. There are still the two ways to either derive from NinjectHttpApplication or to install the nuget package. But now they are based on the same code so that they have the same features. See my blogpost about more details:

http://www.planetgeek.ch/2011/02/22/ninject-mvc3-and-ninject-web-mvc3-merged-to-one-package/

这篇关于什么是配置Ninject为MVC3应用程序的正确方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆