I was developing an application using Entity Framework and storing data in a .mdf database. My code can read the data, apparently it can save too, but only apparently. It ge
I just found what was going wrong, and I guess there's nothing wrong actually. I forced an error, and then I could see the database that I was accessing was in the bin directory, the Visual Studio copied my database to the bin directory everytime I run the app, so that's why if I add some data manually I could see it, but the saves in the runtime aren't persisted. I always worked with database in servers, it's my first time with local databases, so I messed up it, but thankz a lot for the help!
If you wish to disable copying the database on build, then you have to acces the Copy to Output Directoy from the .mdf file from your Solution Explorer.
Simply change it to Copy if newer or Do not copy.
Be aware that Copy if newer holds some risks when accesing a .mdf Database.