Search code examples
c#reminders

How to persist / save program information


I wrote a reminder program that runs automatically on startup. I want to know if there is a way, other than SQL-Server, to store event, date and time data. I do not want to use SQL-Server for this work, because I think SQL-Server is very big for this simple task. I think that I can use a file to store data in it. What do you think about this?


Solution

  • For the part where to persist

    From this document (Managing User Data Deployment Guide, download):

    Windows uses the Local and LocalLow folders for application data that does not roam with the user. Usually this data is either machine specific or too large to roam.

    Windows uses the Roaming folder for application specific data, such as custom dictionaries, which are machine independent and should roam with the user profile.

    So, I suggest using AppData\Roaming and persisting to a file since I consider a 'reminder app' to be user specific. And domain users for example would consider that valuable (syncing to server).

    Local and LocalLow (the latter is used for low integrity mode, for applications with reduced privileges) would be more appropriate for some machine/installation specific data which can be calculated on-the-fly.

    Registry seems great for some low amount of keys, but doesn't seem to be the best option for such use.

    There is another option - IsolatedStorage, which should be used when mentioned options are not applicable, like when using ClickOnce deployments.

    For the part how to persist your data to a file ... well, pick your favorite. You could use SQLite database which comes really lightweigt if you want more control and power or just use XML serialization to a file if you consider using SQLite an overkill. Or any of other viable options.