Developing for Ef Fluenapi, eF6 CodeFirst One to Many MySQL a foreign key constraint fails


+1 vote
asked Mar 16, 2016 by guv_i (190 points)
I'm doing Mapping from existing Database to CodeFirst and I'm having problem with One To Many Relationships.

5 Answers

0 votes
answered Apr 4, 2016 by barley (200 points)
And code first will not create the extra foreign keys.
The property will map to a primary key column in the database.
You can use https://msdn.microsoft.com/en-us/data/jj591583.aspx for this purpose
commented Apr 5, 2016 by cubias (900 points)
What if Blog used the name PrimaryTrackingKey instead or even foo
0 votes
answered Apr 6, 2016 by Holan_9641 (230 points)

For this type, the matching table in database has only two foreign key columns.
Here, we mainly talk about the many end entity: Class.
Classes is a navigation property for the many end.
+1 vote
answered Apr 24, 2016 by Vg7611 (210 points)
Have you tried using this function. Visit Basic Handling and Tips of Database Relationships in ... for more details
0 votes
answered May 27, 2016 by Nal3473mamo (350 points)
I had another problem that led to this issue. See link below to get more details on this http://blogs.msdn.com/b/adonet/archive/2009/11/06/foreign-key-relationships-in-the-entity-framework.aspx this helps
+1 vote
answered Jun 2, 2016 by Gur3387 (200 points)
Have your tried what happens. Find more on EF6 CodeFirst inheritance and foreign relation dependent ... is good for more complex cases
commented Jun 3, 2016 by Show_6852 (220 points)
However, for ObjectContext, we only need to set ObjectContext
commented Jun 4, 2016 by Gozman (680 points)
How Do We Know What Relationships Exist in Entity Framework

What is Geekub?

Q&A site for professional and enthusiast programmers, software developers and other technical users. With your help, we hope to work together to build a library of detailed answers to just about any question that is related to programming!







...