I use the entity framework to create a database and and the data access layer.
All seems to work fine, but now I do have a problem I am not able to solve. It seems I didn't understand something.
If I create an entity A and an entity B I do get two classes Aset and Bset. If they do have a relationship, for example I get an object of ASet in Bset, so. Best contains one Aset. This is exactly what I would like to have.
If I now, create an Aset and an included Bset, it creates a data set for Aset and Bset in the Database A and B.
But if I read the values again, I do get the same classes with the same content until I save it again. In case I save the changes a second time, I still do have Bset, which is updates, but it creates a second ASet. So, after I while I do have plenty of ASet objects in my database.
How can I make sure that I update Bset and do get all object-versions of Aset gets updates, instead of get new ASet created?
Any ideas?
My approach would be, to have a quite complex BSet with several ASets, change several values in this complex object via code or user changes by an UI and then to update all objects by a call of savechanges only via an update of BSet.
Thank you everybody!