循环依赖
我有 2 个项目
- UI:包含我的所有表单和用户控件
- 翻译:包含我用于翻译 UI 的翻译代码
Ui 项目显然需要对 的引用翻译项目,因为它需要翻译。
由于我在 UI 中定义了需要特殊翻译的自定义用户控件。翻译项目需要知道类型,因此翻译还需要对 UI 的引用,从而导致循环依赖。
这实际上是一个问题吗?是的,我该如何最好地解决这个问题?我是否需要取出自定义类型并将它们放入单独的项目中?
谢谢
I have 2 projects
- UI: contains all my forms and user control
- Translation: contains my translation code used to translate the UI
The Ui project obviously needs a reference to the translation project since it needs translation.
Since I defined custom user controls in the UI that need special translation. The Translation project needs to know the type and thus translation also needs a reference to UI resulting in a circular dependency.
is this actually a problem and yes how do I solve this best? Do I take out the custom types and put them in a seperate project?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
遵循良好的实践,尤其是关注点分离,您的翻译库应该对什么一无所知它正在翻译,只是它需要将文本a翻译成b。
通常,这是通过一个或多个方法来完成的,这些方法采用字符串的标识符和要翻译的区域性。
Following good practice, and especially sepatation of concerns, your translation library should know nothing about what it is translating, only that it needs to translate text a into b.
Typically this is done with a methods or methods which take an identifier for a string, and a culture to translate to.