For a personal testing-project I am considering to create a SPA with the following technologies:
ASP.NET MVC + EF + WebAPI + AngularJS.
The project will make use of small amount of data, so I was thinking I could use just a .json file as storage.
But I am not sure about how to proceed with the link between EF and the json file in the initialization of the DbContext.
I found a stackoverflow related question: https://stackoverflow.com/questions/13899342/can-we-use-json-as-a-database
I know the basics of edit files and store data inside. What I tried is to get the data from the json file in the initilizer method and create the objects one by one.
This is more a doubt about how this works if I save/update an object in the dbcontext, do I need to go through all the elements and add/update it manually? Is it better to rewrite the complete file?
According to this https://stackoverflow.com/questions/7895335/append-data-to-a-json-file-with-php it is not a good practice to use json/XML for data wich will be manipulated.
Anyone has experience with anything similar? Is this a really bad idea and I should use another kind of data-storage?
Best Answer
Don't do it! There are so many options these days for actual databases in every context that one should almost never use something else as if it were a database. For small and simple projects, you can at least use SQLite - it's probably used by several apps on your phone!