views:

162

answers:

4

Hi All,

What is the best or preferred way to store data for a .NET desktop application? I know this coupld depend on how I will be using the app but Im just looking for a simple and easy way to store data for .NET applications.

Thanks

A: 

Use isolated storage.

Tom Cabanski
A: 

It kind of depends on the nature of the data, and your "target audience".

If this is a lot of data, maybe file storage is not something you want, and you want to look at a database-like storage.

  • There are server less databases like Sqlite or Sql Server Compact
  • You can use a SQL Server express (or Oracle Home) if you need to scale to a "enterprise" database

If it is some minimal set of user choices, that are often read, and limited written, the registry is a good choice.

If you are in an enterprise environment, you also need to be aware on limitations (policies) that prevent you from storing a lot of data in the user profile.

If you want the user be able to select the files, allow the user to store the data in My Documents, but get the exact location from the user. Technical data is better stored in the "Local Application data" or "Isolated Storage".

etc. etc.

GvS
For the time being, I want to create simple applications such as a journal or calendar with a todo list and these would be for personal usage only. I like the idea of using a server less database for this. There are also applications I have in mind that would have some drop down fields, however I would like to be able to edit the data in the drop down. Would you suggest the registry for something like this?Do you know of any good tutorials that use c# and SQL Server Compact? What other server less databases are there or can you suggest?Thanks
Kory
A: 

You may find that NHibernate suits your needs. NHibernate is an ORM that basically persists your objects in a database (which can be nearly any flavor, but SQL Server Compact Edition would be an appropriate choice for a stand-alone desktop application) and reconstitutes them for you.

I personally do not like or use ORMs, but they are a well-established and popular technology, and because they opaquely encapsulate the underlying database/storage mechanism, they make this decision much less important to an application developer. You could start with NHibernate on top of SQL Server CE, and if SqlCe doesn't work out for some reason you can switch databases without changing the rest of your program.

You don't have to use NHibernate, of course, and the ADO.NET classes provide essentially the same database independence.

MusiGenesis
+1  A: 

Hi

Why not give an OODB a try? You can use db4o.

Best

Adriano

Vagaus