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
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
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.
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.
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.