What's the best way to store/retrieve data for a desktop without using a database?
Asked Answered
V

5

6

i have a question about storing data for a desktop application, if i'm to deployed an application without a MS SQL database, how could i facilitate the retrieving/storing of data. I know i can also serializes the data objects into a file (such as XML file), is there any other more efficient or effective way?

Venetian answered 11/2, 2010 at 4:27 Comment(0)
D
5

SQLite does very well as an embedded database. Even has .NET/Mono bindings available.

Derry answered 11/2, 2010 at 4:29 Comment(0)
D
2

You could look into SQL Server Compact Edition.

Dominican answered 11/2, 2010 at 4:29 Comment(0)
L
1

There are a variety of questions that one would ask to approach answering your question. For the purpose of this answer, I'm going to assume:

1) Limited amount of data needs to be stored. 2) Built-in capability (no third party or database requirement).

The most convenient, built-in (intrinsic to the base .NET installation) is a DataSet - specifically, a typed DataSet.

You can add an indefinite amount of tables and data to your DataSet (limited by available memory) and easily save and load the data from disk. DataSet's easily serialize to schema-bound Xml data.

Lotetgaronne answered 11/2, 2010 at 4:33 Comment(2)
@Michael, yes it's going to be limited amount of data but i would like to by pass the serialization/XML route if possible.Venetian
Am I to understand that you want to save it to binary instead? I guess I'm trying to understand how you want to persist the data on the file system.Lotetgaronne
F
1

I don't think you should be asking which is the "best" way, but which is going to be the best way for YOU.

When you say you can't have a database, I assume you mean the application needs to be stand-alone but could use a local database file? If that is so and you estimate large volumes of data storage will be needed, then you might find you'd like to use one of a number of compact local database products. SQLite and InnoDB come to mind for example.

If you are only going to store small amounts of data, an XML or simple binary file might be better for you, as it would reduce your application footprint, and would remove a dependency on a 3rd party product. We sometimes (and I stress very rarely!) still use the classic INI file because it is well supported in code, and results in extremely compact code.

As to efficiency and effectiveness, that all comes down to how you decide to go about implementing your data access. Granted, the type of database you use has an impact, but you also have to support whatever it is that you implement, so it would pay to look into how the database API is defined and documented, whether it has an active community for support, etc..., and choose the one you feel most comfortable working with.

Fennel answered 11/2, 2010 at 4:49 Comment(0)
D
1

If you are on Windows and need to query data in a simple way, consider the built-in ESENT database engine (http://blogs.msdn.com/windowssdk/archive/2008/10/23/esent-extensible-storage-engine-api-in-the-windows-sdk.aspx). CodePlex has a .NET wrapper which includes a PersistentDictionary class (http://managedesent.codeplex.com/) which works like a .NET dictionary, but is backed by a database file on disk.

Dahlberg answered 12/2, 2010 at 2:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.