❔ Troubleshooting EF Core: Error Message - INSERT Statement Conflicts with FOREIGN KEY Constraint
Hey there facing an issue,
I got a lesson entity that contains a List of questions.
Mapping is done like this:
I am getting an exception when attempting to insert a new lesson, and my assumption is that the foreign key constraint on the questions array is failing because the lesson does not yet have an ID. As a result, the questions array is missing the required foreign key reference to the newly created lesson. Here is an example of the JSON data I am using:
Method like this:
2 Replies
However when debuggin after this line `
it seems correct, lesson is coming back with a guid and its set on the question as a LessonId
nobody got a clue?:D
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.