What is the best local-database solution for WPF applications?

Edward Tanguay picture Edward Tanguay · Jun 12, 2009 · Viewed 10.2k times · Source

What is currently the best solution for WPF applications which are meant to be used on one computer where various users log into them and use them to get/save information locally? Here's how I see the options:

  • MDF would seem to be the best choice since I assume you can lock it down quite well so that even though users can access the .mdf file, they still couldn't access the data in it except through the application itself. I assume the .MDF file would have to exist separately from the application so would deploy the .exe and the .mdf file. Oh, if you use an .MDF file, does the user need SQL Server installed to use it as is indicated in this stackoverflow question?

  • I would think SDF wouldn't be recommended since it has quite a bit of limitations and used mainly for mobile storage.

  • XML might be appropriate if security didn't matter, e.g. a small one-user application to save data that locally that he wouldn't secure anyway, and this file would be easily accessed by other applications/websites on the computer.

  • SQLite might be a choice but from what I know the APIs for .NET for this database aren't that robust yet, are they?

  • .mdb Access might be a choice if you needed users to also edit/view the data or generate reports with Access.

  • there is also IsolatedStorage but I believe this has serious limitations, doesn't it, e.g. not able to access it from other applications?

  • perhaps using a cloud service might be feasible and quite straight-forward nowadays, would have to investigate

Would appreciate any feedback or ideas.

Answer

Dan picture Dan · Jun 12, 2009

SQL Server Compact edition is also an option - http://www.microsoft.com/Sqlserver/2005/en/us/compact.aspx

Deployment is pretty easy using ClickOnce or by copying the engine dlls to the application directory.