如何增加新对象Application_Started后跟踪Ninject? [英] How to add new object to track in Ninject after Application_Started?

查看:103
本文介绍了如何增加新对象Application_Started后跟踪Ninject?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能增加一个新的对象,被激发Ninject应负责在 Application_Started 事件发生后的ASP.NET应用程序(终身,注射等)?

Is it possible to add a new object that Ninject should be responsible for (lifetime, injection etc.) in an ASP.NET application after the Application_Started event is fired?

我的应用程序需要动态指定在应用程序启动后,应该很好跟踪对象

My application needs to dynamically designate objects that should be tracked well after the application is started

推荐答案

如果你有机会到的Application_Start 内核对象C $ C>或者通过使用的公共服务定位​​器,你应该能够调用绑定< T>()来更新上下文的对象。

If you have access to the Kernel object created at Application_Start either by a static reference or [preferably] by use of a Common Service Locator, you should be able to call Bind<T>() on the object to update the context.

我没有亲自试过,但它确实符合阶级结构。

I haven't personally tried this, but it does comply with the class structure.

这篇关于如何增加新对象Application_Started后跟踪Ninject?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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