Search code examples
c#storing-information

If I'm not going to be saving data into an SQL database, where should I be saving it?


I'm making an encyclopedia program of sorts similar to RAWR for World of Warcraft. I'm not going to be saving data de an SQL database, but I've been conditioned so hard to always do this when I'm sure there are alternatives for these lighter case uses.

For example, my program will have no creation of new data via user input, nor deletion of data via user input. Just a program that will display information that I code into it. Nothing more, nothing less.

Where should I save these things? By save I mean, store them for deployment when I release the program.

I'm mostly going to be saving just string variables and some videos/animation (see my other question)

Thanks for the help SO. As always, you guys rock!


Solution

  • What's wrong with the good old filesystem?

    You simply create a subfolder under your application folder and in your code always reference files within this subfolder by using a path relative to the application folder. eg.

    string imagePath=Path.Combine(Environment.CurrentDirectory,"SubFolderName\\picture.jpg");
    

    I've used SQLite myself and love it, but even it may be overkill for your needs as you don't say you need to perform many query operations.

    Also, a relational database such as SQL Server / SQLite is not really ideal for storing binary data. They definitely can, but that is not what they do best as they can run into scaling issues.

    If you have a lot of binary files such as images, music, video etc, then my first choice would be the filesystem.

    Deployment is as simple as putting all required resource files in the subfolder and then placing the subfolder in the application folder.

    Another option would be to store your files as embedded Assembly resources. This could be inside the main application executable, or in a separate dll assembly if you have larger files. You say the user will not be adding or deleting files, so this is a viable option.