Coffeehouse Post

Single Post Permalink

View Thread: Windows Form Application Data Storage
  • User profile image

    , TheJoe wrote

    I am thinking of build a windows application but I a super easy data storage method that does not require a database to be installed.  Would a pure XML file storage setup be practical?

    Any other data storage method suggestions would be great.

    depending on what you are doing you can also use .net binary serialization to save data.

    I wrote a handheld app for windows CE that does this and it was not very hard.

    in my app I save all the files in folders under a folder I named DB

    all of the classes implement a very simple interface that has a string and an int that I use to keep the filenames and I used a class with a lock to create a counter / id that will always give each caller a new id.

    I wrote a main class for the whole thing that has a property to expose each class or a list of class depending on what is needed and I used generic methods to save and get the data.

    so no mater how many data objects I have the same code is used for saving to disk and reading from disk.

    when the app starts I get each saved datafile and restore it into memory.

    any time a change is made I invoke the generic save method.

    and for lists of data I use LINQ to Objects as if I was doing sql on a database.

    works very well and no need for a sql server.