资源/ App.config中或数据库,在那里是应用串的最佳场所 [英] Resources/App.config or Database where is the best place to application strings

查看:99
本文介绍了资源/ App.config中或数据库,在那里是应用串的最佳场所的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有,

我目前正在研究对旧的应用程序,我maintianing并且它使用从两者的App.config和应用程序配置表在DB检索应用的配置设置的混合物。

I was currently looking at on old application that I am maintianing and it uses a mixture of retrieving Application config settings from both the App.config and application config table in the DB.

在新软件我工作(旧的应用程序的一个端口)我有电子邮件地址是静态的,很少改变,这将是用于检索这些最好机构的列表。目前我使用的资源字符串,这样使用起来简单My.Resources,但什么是存储无论是在App.config或数据库表中的信息所带来的好处/缺点。

In the new software I am working (a port of the old application) I have a list of email addresses that are static and rarely change, what would be the best mechanism for retrieving these. Currently I am using resource strings so that using them is a simple My.Resources., but what are the benefits/drawbacks of storing the information either in the App.Config or a database table.

在什么时候它没有任何意义地利用资源?

At what point does it not make sense to use resources?

推荐答案

这一切都取决于? 我的一些经验法则

It all depends? some of my rules of thumb are

作为进入一个配置/资源文件

  1. 这是相同的每个用户,喜欢的路径,图像目录
  2. 数据只需要在UI层面并不会经常变化,如美国国家
  3. 列表
  4. 在它可能会有所不同,从服务器到服务器,像生产VS测试资源网址

作为进入一个DB

  1. 在这每个用户更改或者是特定的用户数据
  2. 在可能需要有人来维持的一面你的开发小组
  3. 这将是UI层外使用
  4. 这将定期更新

你什么都做

不要用力code字符串到code,我不在乎你是如何积极的错误报告通知的电子邮件地址不会改变,不要用力code IT! !或3年的道路会是怎样被一个2秒的配置变化将导致在2个星期的工作得到一个过时了的遗产一块废话应用程序编译!或其他有趣的一次是一个XML架构硬codeD插入应用程序

DON'T HARD CODE STRING INTO YOUR CODE, I don't care how positive you are that the bug report notify Email address will not change, DO NOT HARD CODE IT!!!! or 3 years down the road what would have been a 2 sec config change will result in 2 weeks of work to get an out dated legacy piece of crap application to compile!! or another fun one was an xml-schema hard coded into an application with

stringname += "Schema data";
stringname += "Schema data";
stringname += "Schema data";

奇怪的是同一个人,去图。

Oddly enough same guy, go figure.

这篇关于资源/ App.config中或数据库,在那里是应用串的最佳场所的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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