When I try to enter this in my database I get the error: Unable to determine the principal end of the 'Site.Data.Prediction_PredictionGroup' relationship. Multiple added entities may have the same primary key.

2 Answers
2

I'm not sure you models are correct and that is why you needed to add Fluent API code. You shouldn't need the Fluent API code for this. The [ForeignKey] definitions goes on the property that is the foreign key value and points to the object it is the key for. So the property attribute goes on ResultPredictionId and says it for the property ResultPrediction. Currently it's done the opposite.