Using json as database with EF, how can I link EF and the json file during DbContext initialization?
Posted
by
blacai
on Programmers
See other posts from Programmers
or by blacai
Published on 2014-08-21T18:04:01Z
Indexed on
2014/08/21
22:26 UTC
Read the original article
Hit count: 364
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: http://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 http://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?
© Programmers or respective owner