IOC across visual studio projects?

人盡茶涼 提交于 2019-12-08 14:38:24

Could you not write a configuration module inside each project, and only make that public? Then configure ninject with all of the modules instead of a single one...

I believe you're on the right track. In general any IoC Container is going to need to be aware of (a) the interface and (b) the implementation so it can wire everything up. You generally do the "wiring" in higher-level modules (your configuration module project in this case); the lower-level modules don't need to know about all possible implementations of the interfaces. In order to make this happen (and to facilitate testability) the implementations need to be public.

If you really wanted to you could use InternalsVisibleTo, but I wouldn't. If you were not using IoC, you'd need to make these classes public anyway.

You could also look into MEF; apparently it allows the implementations to be private or internal.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!