[EMAIL PROTECTED] wrote: > Hi, > I would like a bit of advice before starting to make changes to my > application. > > I've written a program in C# for personnel departments and at present all of > the data is stored in memory until the user saves and then it is written to > disk as an XML file. > > I'd like to switch to an embedded SQLite database where the database becomes > the file format for the application. I plan to use the ADO.Net wrapper for > SQLite. > > Can anybody tell me if the following is a reasonable design for implementing > this- > > Upon loading a saved file into the application the database on filesystem is > loaded into an ADO.Net DataSet. This is used by the application until the user > saves to disk again when all of the changes to the DataSet are saved back to > the database on disk. >
In all of the desktop apps that I write, I omit the File->Save option altogether. File->Open opens the SQLite database and there after all changes are saved to the disk as they are made. I find this works much better since you avoid losing all your work when the power goes off unexpectedly - or when you power down at the end of the day and forget to close out the file you were working on. Would that OpenOffice did the same... Another advange is that if you open the same file twice in two separate windows, the second one opened still sees all the latest changes. And you cannot trash work by doing File->Save in the wrong order. When your changes are saved to disk immediately, it is important to have a good undo/redo mechanism. There is some example code on the wiki showing how to implement undo/redo using triggers. -- D. Richard Hipp <[EMAIL PROTECTED]> ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------