Entity Framework: Foreign Key in code first

c# code-first entity-framework entity-framework-6 foreign-keys

Accepted Answer

ZZZ_tmp
5
9/28/2017 5:02:02 AM

Popular Answer

It appears that you are in a circular dependency.

We are Answers here:


Optional upgrades:

  • Your navigational features should be declared as virtual!

  • Change the definition of your [ForeignKeyAttribute] Data Annotation to if you are using C# 6.0 or above.[ForeignKey([nameof(BestFoodId))] so as to prevent mistakes with hard-coded property names. A particularly amazing compiler feature is nameof.



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