Cannot add multiple same objects to DB, only distinct are saved. .NET EntityFramework
I have a template of exercise with name, description and amount of sets. I want to create multiple objects of Exercise * amount of sets. For example I have template [{ "name" : "Legs", "sets" : 3 }, { "name" : "Arms", "sets" : 2 } in DB I want to be saved [ {legs}, {legs}, {legs}, {arms}, {arms}], but only [{legs}, {arms}] are saved.
In attached screen they are all saved with exerciseId 1024 or 1025 instead of all be unique in range 1024-1028. In property exercises i have 5 objects without IDs but entityframework after saving changes gives them same IDs for objects with same structures, altho they are diffenent objeects.
In attached screen they are all saved with exerciseId 1024 or 1025 instead of all be unique in range 1024-1028. In property exercises i have 5 objects without IDs but entityframework after saving changes gives them same IDs for objects with same structures, altho they are diffenent objeects.




