应用程序配置和设置的方法(在ASP.NET MVC中)(Approaches for Application Configuration and Settings (in ASP.NET MVC))

编程入门 行业动态 更新时间:2024-10-24 06:38:18
应用程序配置和设置的方法(在ASP.NET MVC中)(Approaches for Application Configuration and Settings (in ASP.NET MVC))

对于CMS产品/平台,用于编辑和存储设置的可维护和清晰的方法是什么?

我不是在谈论技术(connstring,nh config,...)设置,而是改变产品行为的设置:

这些设置是例如

在线支付设置 可用的零件和模块 应用程序的默认行为(默认显示列表项的详细信息,某些操作后的默认登录页) ...

在这一点上,我们并没有真正的方法,所以结果是所有的设置都会在web.config中结束。

这可能不是最好的方法,因为这仅仅是无尽的密钥值对列表的结尾......

在这种情况下,我们也不能真正预测类型(没有codegen),所以带有复选框或预定义选项的设置很难管理。

另一个选择是为每个设置(类型)创建所需的表格并将其用作核心设置系统,但这对于每个客户的部署和管理将更加困难。

我有很多这个问题的一半答案,但不是真正的自上而下的解决方案...

我的意思是自上而下:

编辑设置(管理屏幕) 在哪里坚持设置 加载设置,没有太多麻烦,但仍然以可维护的方式 维护/部署客户特定设置

所以迄今为止的选择:

(网页)的.config .settings文件 D B

但是,这些都是关键价值方法......还有其他建议吗?

For a CMS product/platform, what would be a maintainable and clear approach for editing and storing settings?

I'm not talking about technical (connstring, nh config, ...) settings, but settings that alter the behaviour of the product:

These settings are for example

Online Payment settings Available parts and modules Default behaviour of the application (showing details of list items by default, default landing page after certain actions) ...

At this point we don't really have an approach, so the result is that all settings end up in the web.config.

This is probably not the best approach, since this is simply ending in an endless list of obscure key value pairs...

In this scenario we also cannot really anticipate to types (without codegen), so settings with checkboxes or predefined options... are hard to manage.

Another option would be to create the needed tables for each setting (type) and use that as a core setting system, but this will be harder to deploy and manage per customer.

I have lots of half answers to this question but not really a top down solution...

What I mean by top down:

Editing settings (admin screen) Where to persist the settings Loading the settings, without much hassle, but still in a maintainable way Maintain/deploy customer specific settings

So options so far:

(web).config .settings files DB

But these are all kind of key-value approaches... Any other suggestions?

最满意答案

您可以编写一个自定义配置部分 ,它允许您在配置文件中存储比键/值更多的设置。 这就是说配置文件是为只读设置而设计的。 如果您需要使用管理员屏幕编辑功能,那么最好使用数据库。 将这些信息存储在文件中也是可能的,但由于这是一个多线程应用程序,因此您需要正确地同步访问这些可能很快变得繁琐的文件。

You could write a custom configuration section which allows you to store much more than key/value settings in the config file. This being said the config file is designed for read-only settings. If you need editing functionalities with admin screens then it would be best to use database. Storing this information in files is also a possibility but as this is a multi-threaded application you will need to properly synchronize access to those files which could quickly become cumbersome.

更多推荐

本文发布于:2023-07-16 12:40:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1128560.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   方法   NET   ASP   MVC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!