棱柱和圆相关性
我必须棱镜模块,它们都依赖于对方提供的服务。有没有办法以安全的方式呈现相互依赖?我曾考虑过将它们组合成一个模块,但它们确实没有逻辑上组合。
顺便说一句,我知道 MEF 可以做到这一点;我知道MEF很棒!我爱MEF。我无法切换到该技术,因为它需要对框架和 IDE 进行升级,而我现在(时间方面)负担不起。
如果您遇到和我一样的问题,请查看 MEF。对我来说已经太晚了;救救你们自己吧!
I have to prism modules that are both dependent on services the other offers. Is there a way to present interdependence in a way that is safe? I've thought about combining them into a single module, but they really don't logically combine.
BTW, I know MEF can do this; I know MEF is awesome! I love MEF. I can't switch to that technology because it would require an upgrade in the framework and IDE that I can't afford (time wise) right now.
If you are having the same trouble as me go check out MEF. Its to late for me; save yourselves!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我看来,逻辑解决方案是将这两个模块之间共享的服务提取到第三个模块中。然后,您的两个当前模块都可以安全地依赖于共享模块,您没有循环依赖关系和良好分离的项目结构。
有什么理由不能这样做吗?
It seems to me that the logical solution is that the services which are shared between these two modules get extracted into a third module. Your two current modules can then both safely depend on the shared module, you have no circular dependencies and a nicely separated project structure.
Any reason this can't be done?
我知道该怎么做了。演示服务在初始化时不需要超时服务,因此我在惰性属性中解决了它。
由于超时服务是在其模块初始化时注册的,因此该属性在需要时可用。它并不理想,但它有效。这个故事的寓意是与 MEF 一致。
叹息!
I figured out what to do. The timeout service is not needed by the presentation service at initialization, so I resolved it inside a lazy property.
As the timeout service is registered at initialization of its module, this property is available when it is needed. Its not ideal, but it works. The moral of the story is go with MEF.
Sigh!