bitdisaster
bitdisaster

Reputation: 31

EF4 foreign key relationship to unique key not recognized

I have two tables A and B in my db with a foreign key between both. Table A has a PrimaryKey and UniqueKey. Table B is referencing Table A by using the UniqueKey. If I generate the ef model from the database then no association between A and B is generated and I couldn't find a way to manually add the association. However, Linq2Sql recognizes the relationship as expected. Any ideas?

Upvotes: 3

Views: 1141

Answers (1)

Ken Smith
Ken Smith

Reputation: 20445

See this MSDN blog post: http://blogs.msdn.com/b/efdesign/archive/2011/03/09/unique-constraints-in-the-entity-framework.aspx. In brief, this isn't supported in V4, though the EF team seems to have plans to support it in future releases.

Upvotes: 3

Related Questions