From a foreign key in a table, EF does not construct a foreign key association.

entity-framework

Question

I have two tables: tblEvent and tblContact. A foreign key connects the ContactID field in tblEvent to ContactID in tblContact. I double and triple verified, and the database has the foreign key.

Unlike the other foreign keys, the navigation property and foreign key association for this one is NOT generated by the Entity Framework model.

Why would this foreign key be unique if EF does not provide a navigation property for it?

Thanks!

1
13
12/10/2010 9:27:05 AM

Popular Answer

I discovered the answer here:

Why doesn't EF 4 provide an association for the FK connection to the unique index column?

The table's unique non-clustered index on the foreign key field was the source of the inability to recognize it.

Evidently, a singular, non-clustered index permits the existence of a null value that cannot be mapped.

12
5/23/2017 12:33:33 PM


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