I've reviewed other related questions on StackOverflow, but I haven't found one that matches my exact question or scenario.
I have an JavaScript front-end where I have two entities that are linked, so in the front-end I have JSON objects that get 'linked' to each other like this:
entity1
name = "something"
entity2Id = 0
entity2
1st record
id = 0
name = "something else"
2nd record
id = 1
name = "something else again"
I then send the JSON to a .NET back end, and the idea is that as I'm manually specifying the primary key for entity2 and setting that as the 'foreign key' reference in my entity1, Entity Framework then somehow needs to generate a valid id for entity2, and maintain a reference to that id in the entity2id
property of entity1.
I suspect I may be getting this all horribly wrong and that there's a fairly standard approach to achieving what I'm trying to do. What should I do to achieve the desired result? (I'm using a SQLite database, which probably doesn't make a difference.)