在哪里存储全局设置,以允许应用程序频繁访问它们,而不会给数据库带来很大的开销

发布于 2024-10-20 18:29:39 字数 219 浏览 9 评论 0原文

我的应用程序中有一些全局设置,将由管理员处理,并将它们存储在数据库中。

设置如下:板开/关、不同用户控件上的最大项目/页面、语言、隐藏/显示模块。

我应该遵循什么技术来读取数据库中的值并根据它显示页面或应用程序..当然我可以用简单的方法来做到这一点并在 Page_Load 事件处理程序中获取每个页面所需的设置,但我认为会出现很多数据库连接!

有没有更好的方法来实现这一目标?

I have some global settings in my application that is going to be handled by the administrator and I store them in the database.

Settings like: board on/off, max items/page on different UserControls, language, hide/show modules.

What technique should I follow to read the values in the database and display the page or the application according to it .. Of course I could do it the easy way and fetch the required settings for each page in the Page_Load event handler but I think that will be a lot of database connection!

Is there is any better way to achieve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

远昼 2024-10-27 18:29:39

您可能希望将设置加载到应用程序状态global.asax 中的 Application_Start 上。

You probably want to load your settings into the Application state on Application_Start in your global.asax.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文