XML, SQL Server Compact, or Something Else?
I am developing a desktop application that will need to collect data (from the user) and store it locally in a secure fashion. It will need to synchronize this data with a central database when an internet connection is available. The application is WPF and I would like to take advantage of the n开发者_如何转开发ew data-binding features of WPF. I really want this application to be lightweight, and thus not having formal business objects, and just binding directly to the XML file. My issue with this however is security. I could see encrypting the XML files, is that a realistic option. Another reason I wanted to use XML is for interfacing with other applications (on the desktop), which for this type of application, happens a lot.
On the flip side, there is SQL Server Compact, but to use it, I would most likely want business objects to represent tables, and to interface with other applications I would need to spit the data out to XML anyways. Security would be easy, just add a password to the database.
What do you guys think? Is there something I'm not taking into consideration, have I given enough information about my problem domain?
I've just finished an application that does exactly this, i.e. local database with sync to remote (SQL2008). I spent a lot of time looking into this and finally settled on:
- WPF
- SQL Server CE
- Entity Framework
- Sync Framework ( -> SQL server 2008 using change tracking in my case)
I realise that you want something lightweight - but I have to say that Entity Framework & Bindings take most of the pain out of databinding and building the UI, so you can concentrate on the problem in hand rather than the technology.
I would use WCF to bind to external applications.
If you need some local storage without any fuss, you should definitely also look at SQLite.
It has great .NET support including support for Entity Framework, and is basically frictionless and needs no installing a server or anything like that (just include some DLL's in your application's deployment - xcopy or otherwise).
It also allows you to encrypt the entire database file (*.s3db) to protect its contents.
精彩评论