Connection table not mapping to object

c# entity-framework entity-framework-6

Question

I have a database with a Users table, and users can have friends. Users create content in my Content table, which has a UserId as a foreign key. So far everything is good. Entity Framework creates 2 entities - one for Users and one for Content. And the Users entity has navigation to contents collection (ont user can have many Content records).

I've created another new table so users can "Like" content. So I have ContentLikes table which has a UserId (as a foreign key for the users table), and I have a ContentId (as a foreign key for the contents table). My problem is that Entity Framework doesn't map those objects in any way - I don't see entity for likes or a navigation property in the contents entity.

When i try to add that table EF says it is already mapped.

What am I missing here?

Update:

I see the following in the errors:

Error 6004: The table 'ContentLikes' is referenced by a relationship, but cannot be found.

1
1
3/31/2016 4:35:43 AM

Popular Answer

Check whether the foreign table and 'ContentLikes' table of column both same datatype and allow nulls. After long time i found the solution for this issue and now working fine.

3
10/13/2014 11:35:50 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow