简体   繁体   English

在.NET应用程序中对资源进行分组的最佳策略是什么

[英]What is the best strategy for grouping resources in a .NET application

Where should resource files go and at what granularity (application/assembly/namespace/class/...)? 资源文件应该放在哪里以及粒度(application / assembly / namespace / class / ...)?

Using a layered architecture one can split an applications into separate dedicated assemblies. 使用分层架构,可以将应用程序拆分为单独的专用程序集。 An advantage is that it is easier to manage dependencies and ensure that code does not get entwined. 一个优点是更容易管理依赖项并确保代码不会缠绕在一起。

During application wide refactoring, pieces can be split out into separate assemblies or moved into their own assembly. 在应用程序范围内的重构期间,可以将碎片拆分成单独的组件或移动到它们自己的组件中。 This could happen because the functionality had matured enough to be moved into the core layer or has become large enough to warrant moving it into its own assembly. 这可能发生,因为功能已经成熟到足以移动到核心层或已变得足够大以保证将其移动到其自己的组件中。

During the refactoring process resource might have to be moved. 在重构过程中,可能必须移动资源。 It might be more or less difficult depending on the strategy used for grouping resources and the type of refactoring being done. 根据用于分组资源的策略和正在进行的重构类型,它可能或多或少地困难。 Resources (strings, images, files, etc...) could have been grouped in quite a few ways: - in a single resource file per assembly, - in a resource file per namespace within an assembly, - in a resource file for each class, - in a single assembly shared by all assemblies within the application, - etc. 资源(字符串,图像,文件等)可以通过多种方式进行分组: - 在每个程序集的单个资源文件中, - 在程序集中每个命名空间的资源文件中, - 在每个资源文件中class, - 在应用程序内所有程序集共享的单个程序集中, - 等。

Refactoring is just one operation which could be affected by the chosen grouping strategy for resources. 重构只是一项可能受所选资源分组策略影响的操作。 Other operations, like translation of the strings in the resource files will also be influenced. 其他操作,如资源文件中字符串的翻译也会受到影响。

What grouping strategy is considered best and why? 什么分组策略被认为是最好的,为什么?

Just making more of a comment than an answer here, but you should have a look at this: MSDN Internationalization page . 只是在这里做出更多的评论而不是答案,但你应该看一下: MSDN国际化页面

Whatever decisions you make regarding resources should keep in mind how your structure will work with internationalization, if you have to go international then you will have big problems if your structure constricts you. 无论你对资源做出什么决定都应该记住你的结构如何与国际化合作,如果你必须走向国际化,那么如果你的结构收缩你就会遇到很大问题。

我通常将资源绑定到程序集,但如果您不确定将来会带来什么,那么共享资源dll可能是一个很好的解决方案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 基于.NET3.5的最佳策略,用于创建断开连接的db应用 - Best .NET3.5 based strategy for creating disconnected db application 允许应用程序以客户为主题并发布以供下载的最佳策略是什么? - What is the best strategy to allow an application to be themed by an customer and published for download? 针对Ajax请求的Asp.Net MVC操作中处理未处理的异常(错误500响应)的最佳策略是什么? - What is the best strategy to handle unhandled Exceptions (error 500 responses) in Asp.Net MVC actions for Ajax requests? 在.Net WCF服务框架中公开多个DataObjects / Methods的最佳设计策略是什么? - What is the best design strategy for exposing multiple DataObjects/Methods within the .Net WCF service framework? Equals 和 GetHashCode 的最佳策略是什么? - What's the best strategy for Equals and GetHashCode? 什么应该是最好的异常处理策略 - What should be the best Exception Handling Strategy Selenium 中与 WebElement 交互的最佳等待策略是什么 - What is the best wait strategy in Selenium for interacting with a WebElement 在.NET应用程序中传递XML的最佳方法是什么? - What is the best way to pass around XML in a .NET application? .NET客户端应用程序连接到WebSocket服务器的最佳方法是什么? - What is the best way for a .NET client application to connect to a WebSocket server? 在VB.NET应用程序中使用服务的最佳方法是什么? - What is the best way of working with Services in a VB.NET application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM