简体   繁体   English

在服务器应用程序中存储配置信息的最佳方法是什么? (没有数据库)

[英]What is the best approach to store configuration info in a server application? (No database)

I have a server application written in C#. 我有一个用C#编写的服务器应用程序。

As the application running, there will be tens of thousands of key->value mapping generated, and this info needs to be persisted . 作为应用程序运行,会有键- 数万 >值映射产生的,这个信息需要保留 For each of these mapping records, there will be update/delete operation. 对于这些映射记录中的每一个,都将进行更新/删除操作。

What is the best approach to store it? 存储它的最佳方法是什么? No database. 没有数据库。

Is there any performance issue with ConfigurationManager in such case? 在这种情况下, ConfigurationManager是否存在任何性能问题?

How about for thousands of records? 成千上万的记录怎么样? Is it possible to avoid using any database? 是否可以避免使用任何数据库?

Thanks! 谢谢!

I know you said "No database", but consider the use of SQL Server Compact which provides a free, small-footprint SQL Server capability that you don't need to install - it's kind of like a grown up version of Jet. 我知道你说“没有数据库”,但考虑使用SQL Server Compact ,它提供了一个免费的,占用空间小的SQL Server功能,你不需要安装 - 它有点像Jet的成熟版本。

Alternatively, you might want to see if you can find an ISAM implementation. 或者,您可能希望查看是否可以找到ISAM实现。

So you can always use XML for it. 所以你总是可以使用XML。 Or really use ConfigurationManager files (here is some example MSDN or here Loading custom configuration files ) 或者真的使用ConfigurationManager文件(这里有一些MSDN示例或这里加载自定义配置文件

You may not be able to use a fully fledged database, but you could consider an embedded SQL Engine: 您可能无法使用完全成熟的数据库,但您可以考虑使用嵌入式SQL引擎:

SQL Compact Edition or SQLLite SQL Compact EditionSQLLite

I've never used SQL CE, but SQLLite is just a single DLL. 我从未使用过SQL CE,但SQLLite只是一个DLL。

Obviously you don't have all the features of a fully fledged database engine, but they are still pretty powerful and certainly much better than Configuration Manager for persisting data. 显然,您没有完全成熟的数据库引擎的所有功能,但它们仍然非常强大,当然比Configuration Manager更好地保存数据。

Assuming the fact you're required to have no database by your hosting, there are still several options: 假设您的托管要求您没有数据库,那么仍有几个选项:

  1. SQL Server Compact approach when you just place your DB files under App_Data and use ADONET to get to those as if it was a fully functional SQL server. 当您将数据库文件放在App_Data下并使用ADONET来获取那些就好像它是一个功能齐全的SQL服务器时,SQL Server Compact方法。
  2. OLEDB connection to csv, dbf or any other structured file. OLEDB连接到csv,dbf或任何其他结构化文件。
  3. Homegrown solution - something like an IDictionary<> collection persisted manually into an XML, flat file, binary array or whatever else. 本土解决方案 - 类似于IDictionary <>集合的东西手动持久化为XML,平面文件,二进制数组或其他任何东西。

I agree with Steve Morgan. 我同意史蒂夫摩根的观点。 I recommend SQL Server Compact. 我推荐SQL Server Compact。

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

相关问题 什么是将关键字存储在数据库中,与语言无关的最佳方法 - what is the best approach to store keywords inside database, language agnostic 没有数据库来存储联系人/地址类型的信息的最佳格式是什么? - What is the best format to store contact / adress type of info without database? 缓存信息的最佳方法是什么? - What is the best approach when caching info? 存储/设置C#应用程序配置设置的最佳方法是什么? - What is the best way to store/set configuration settings for a C# application? 轮询数据库时最好的方法是什么? - What is the best approach while polling database? 什么是缓存数据库查询的最佳方法 - What is the best approach for caching database queries 动态创建UI和数据库,最好的方法是什么? - Creating UI and database dynamically, what is the best approach? 更好的方法来存储配置设置-内存中还是数据库中 - Better approach to store configuration settings - in-memory or database 开发BlackBerry Web应用程序(WebWorks Application)的最佳方法是什么? - What's the best approach for developing a BlackBerry web application (WebWorks Application) Windows Store App的登录屏幕-最好的方法是什么? - Login Screen for Windows Store App - What would be the best approach?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM