简体   繁体   中英

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

I have a server application written in 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?

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.

Alternatively, you might want to see if you can find an ISAM implementation.

So you can always use XML for it. Or really use ConfigurationManager files (here is some example MSDN or here Loading custom configuration files )

You may not be able to use a fully fledged database, but you could consider an embedded SQL Engine:

SQL Compact Edition or SQLLite

I've never used SQL CE, but SQLLite is just a single 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.

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.
  2. OLEDB connection to csv, dbf or any other structured file.
  3. Homegrown solution - something like an IDictionary<> collection persisted manually into an XML, flat file, binary array or whatever else.

I agree with Steve Morgan. I recommend SQL Server Compact.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM