Answer the question
In order to leave comments, you need to log in
The entity in the EntityFramework pulls up the wrong data, how to understand?
I will explain with a picture)
There is an entity Wine, which has a parent entity WineRegion. In this example, WineRegionId = 35. But when we expand the parent entity WineRegion, as shown in the following picture,
Its ID is 6.
Remarkably, there is also a parent entity, WineCountry, whose value, WineCountryId, for this entity, is also 6.
Why are not pulled those data.
This project is written in ASP.NET MVC, EntityFramework is used as ORM
Answer the question
In order to leave comments, you need to log in
WineRegionId and WineRegion primary key are not related. and WineRegion is a child entity
. How is the model created? code-first, db-first? show the source of the entities
metanit.com/sharp/entityframework/index.php
search and read learn
:)
google lazy vs eager loading
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question