WPF棱镜最佳实践资源 [英] Best Practice WPF Prism Resources

查看:102
本文介绍了WPF棱镜最佳实践资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有几个模块的WPF棱镜桌面应用程序.过去,我将所有本地化的资源都放在基础结构程序集中的公共资源文件中,并在所有模块中都引用了它.

I have a a WPF prism desktop app with a few modules. In the past I've put all my localized resources in common resource files in the infrastructure assembly and referenced it in all modules.

但是最近我一直在想,从维护的角度来看,这是否确实是正确的方法.从本质上讲,它还打破了模块化.从长远来看,在模块本身中包含特定于模块的资源文件是否是一种更好的方法?

But lately I have been wondering if that is indeed the right approach from a maintainence perspective. In essence it also sort of breaks modularity. Would having module specific resource files in the the modules themselves be a better approach in the long run?

所有想法都很感激.

推荐答案

就Prism的主要目标之一而言,模块化是显而易见的,只将资源放在适当的程序集中.通过一个集中式程序集共享资源与模块化相反. 如果要添加更多(可选)模块,则以集中方式进行操作将使您获得另一种类型的DLL地狱.您将不得不在不了解使用通用程序集的模块的情况下更新通用程序集.并且再次确定存在哪个模块违反了模块本身.另一种方法是始终将通用程序集更新为最新版本. 无论您做什么,遵循集中式方法都会迫使您构建所有向后兼容的模块.

As far as one of Prism's main targets is modularity it just seems obvious to put your resources only in the appropriate assembly. Sharing resources via one centralized assembly is the opposite of modularity. Doing it the centralized way will get you another type of DLL hell at the time you want to add more (optional) modules. You will have to update the common assembly without the knowledge of the modules that use the assembly. And determining which module is present just again violates the modularity itself. The other way is to always update the common assembly to the latest version. Whatever you do, following the centralized approach forces you to build all your modules backward-compatible.

这是我目前的观点.但是就我与Prism一起工作仅几周而言,我不确定我的陈述是否是应如何处理的方式.

This is my point of view at the moment. But as far as I'm working with Prism for only a few weeks now I'm not quite sure if my statement is the way how it should be done.

这篇关于WPF棱镜最佳实践资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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