Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework trying to retrieve non existent column

enter image description here

I'm trying to retrieve the VideoCollection items from the database, but getting {"Invalid column name 'User_Id'."} - when I set a breakpoint I can see that the EF is trying to select User_Id column but it doesn't exist in the Cs object or the database schema. (It does exist in another table but that shouldn't matter). Is there anyway to debug why this is happening?

like image 289
greenimpala Avatar asked Sep 25 '11 14:09

greenimpala


1 Answers

Do you have a User class that has a reference to a VideoCollection? If so, you probably need to explicitly define the relationship between the two. As it is, it looks like EF is inferring that the VideoCollection should contain a foreign key, User_Id that defines the relationship.

like image 75
tvanfosson Avatar answered Nov 09 '22 03:11

tvanfosson