Ninject-ing a dependency in Global.asax

前端 未结 4 591
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 11:56

I\'m starting a web application with MVC3 and Ninject. There is one dependency that I also need in the Global.asax file that needs to be a singleton.

I thought it sh

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 12:25

    The MVC extension injects the HttpApplication by default. But only property injection can be used! So just add a property decorated with the Inject attribute.

提交回复
热议问题