This is a very simple issue, and I haven’t been able to find a satisfactory answer. My setup is simple, two tables with a Foreign Key to connect them. I’m able to successfully update both tables wtih EF, but the ID value from the Parent table isn’t populated when I call SaveChanges. Do I have to manually assign the ID value from the Parent table to the appropriate property in the Child table to get the Foreign Key to be populated in the database? It seems odd that I would have to do this as it seems like it should be automatic, but I am new to EF. Thanks!
Share
Yes, it does keep these in sync, with limitations. Here’s an explanation of what’s involved. You do not have to manually assign IDs.
You don’t give enough information in your question to solve your problem, but here are a few things to check: