在asp.net web应用程序处理的配置设置 [英] Handling configuration settings in asp.net web application

查看:156
本文介绍了在asp.net web应用程序处理的配置设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有超过200配置设置的Web应用程序。这些控制从用户界面到业务逻辑的一切。

I have a web application with over 200 configuration settings. These control everything from UI to Business logic.

如果这些可以在应用程序启动检索或在需要的时候?

Should these be retrieved on application startup or when they're needed?

他们应该用在需要的时候一个ISettings接口被注入。

Should they be injected with an ISettings interface when needed.

请告诉我你的意见?

更新:
这些可以打开和关闭在应用程序进行切换,以便将它们存储在数据库中。有些是每个用户的设置,有些是应用广泛。现在的想法?

Update: These can be switched on and off in the application so they are stored in the database. Some are per user settings, and some are application wide. Thoughts now?

推荐答案

我们有很多的配置设置,太。我们将其存储在中央数据库中的表。在第一次访问,我们从数据库中加载所有这些,他们缓存存储以1分的绝对过期。这让我们有我们的配置设置的内存拷贝,同时也让我们能够推动我们知道将被应用,配置更新顶多1分钟。

We have a lot of configuration settings, too. We store them in a central database table. On first access, we load them all from the database and store them in Cache with an absolute expiration of 1 minute. This allows us to have an in-memory copy of our configuration settings, while also allowing us to push configuration updates that we know will be applied in, at most, 1 minute.

所以,它是一种混合型的。对配置设置的第一个请求,它们都加载并存储在缓存中。此操作是pretty重量轻,所以有它发生的每一分钟是不是一个大问题我们。

So, it's kind of a hybrid. On the first request for a configuration setting, they are all loaded and stored in Cache. This operation is pretty light-weight, so having it happen every minute is not a big deal for us.

您的里程可能会有所不同。

Your mileage may vary.

这篇关于在asp.net web应用程序处理的配置设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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