将 Ninject 模块添加到现有内核
我有一个场景,应用程序中有很多功能,这些功能是根据网络上存在的网络设备启用和禁用的。我正在使用 Ninject 来管理应用程序中当前的功能树。
我想要做的是能够在应用程序运行时添加和删除一组到我的内核的绑定。我想使用类似 Ninject 模块的东西来将它们捆绑在一起,但是我不知道如何从现有内核中添加/删除模块。
有人知道如何做到这一点或有更好的选择吗?
I have a scenario where I have a bunch of features in an application which are being enabled and disabled on the basis of network devices being present on the network. I'm using Ninject to manage my current feature tree within the application.
What I want to do is to be able to add and remove a set of bindings to my kernel while the application is running. I would like to use something like a Ninject module to be able to bundle these together, however I can't figure out how to add/remove a Module from an existing Kernel.
Anyone know how to do this or have a better option?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要在第一次解决后尝试添加/删除!内核应该在解析对象之前完全配置,并且在第一次解析之后配置不应再更改解决。
请改用条件绑定:
Don't try to add/remove after the first resolve! The kernel should be configured completely before resolving objects and the configuration should not change anymore after the first resolve.
Use conditional bindings instead: