Entity Framework Code First Not Pulling Navigation Property -


I have a problem loading the navigation property. I have this same setup with all other institutions, but it is using a property which is not a natural FK and will be used for cascade, which will be controlled by a trigger.

  Expression & lt; Func & lt; Division baket game explorer, object & gt; & Gt; [] In 2 = {q = & gt; Q. Division Winning Bracket Game, q = & gt; Q.DivisionLoserBracketGame}; Var test = _divisionBracketGameParticipantsRepository.GetMany (includes 2; q = & gt; q.DivisionBracketGame.DivisionBracket.Division. EventId == eventId);   

database schema

  division bracket game id number divisionbacket gamepreredirer id divisionbacket game id - & gt; Id divisionbacketgammerwirenumber - & gt; Number DivisionBacket Game Game Number - & gt; [Division ("Divisionbacket Game", Schema = "GrasRoots Hopes")] Division of Public Sector: Baketty {number}   

Organizations

Related to EF number Will not create because the primary key is your DivisionBracketGame id both DivisionWinnerBracketGame and DivisionLoserBracketGame targeting ID (not number ).

One-to-many relationship demands that the column in the principal table is unique - in your case the column should be a number . It is possible in the database by using the primary key from the primary table or by using unique index on that column. EF does not support unique indexed / candidate keys, so the only way to create multiple-to-one relationships in EF is through the primary key of the main table.

The FK value is used to get related value, at this time it probably looks at the archives with the wrong value because it uses the wrong column.

Comments