1

Resolved

Store data in embedded database

description

The data is stored in DataTables and then serialized to XML. This is fine for quick, simple projects, but if the server crashes unexpectedly and the data is not serialized, then the server loses important information about outstanding jobs.
 
The proposed solution is to use an embedded database for data storage. The tradeoff is better persistence and constancy when the program crashes while I have to write more code to map columns to fields and then display in the GUI.

comments

joes wrote May 13, 2008 at 4:47 PM

I tried using SQL Compact Edition but I ran into two hurdles:
1) The min and max values of DateTime are different for .NET objects and for SQL CE. This meant I had to pick an arbitrary datetime to mean idle, and I try to avoid magic numbers as much as possible.
2) The deal-breaker was when the multi-threaded application caused SQL to hang. Maybe the code I wrote was bad, but I've written similar code against regular SQL without issue. I need the background threads to update, and I need the GUI thread to take user input. I cannot do everything on one thread. So, this caused me to drop SQL CE.

Now the code is writing xml files with serialized objects. It's basically a poor-man's database with no lookup table and no foreign key constraints. But it works for the needs, and it solves the problem of the server code crashing and losing results.

wrote Feb 1, 2013 at 4:35 AM

wrote May 14, 2013 at 6:44 AM

wrote May 14, 2013 at 6:44 AM

wrote Jun 4, 2013 at 1:55 AM