By News Staff · Posted
By monterxz · Posted
By monterxz · Posted
By +sphbecker · Posted
By notuptome2004 · Posted
We rely on ads to keep creating quality content for you to enjoy for free.
Please support our site by disabling your ad blocker.
Continue without supporting us
If the prompt is still appearing, please disable any tools or services you are using that block internet ads (e.g. DNS Servers, tracking protection or privacy extensions).
Question
Jose_49
Hello neowin community! I know many badasses over here that can help me through my problem. I haven't fully understood how does Lazy loading works in Entity Framework. In fact, I haven't understood how to work with Navigation Properties, Foreign Keys, using Entity Framework at all. I haven't found a tutorial which explains me baby-step by baby-step how is it achieved. So I'm just jerking off code (something I don't like doing).
I currently have the following model (Using ASP.NET MVC 5 + Entity Framework 6)
so here it is.
So, what do I want to achieve?
Easy:
Perform a modified CRUD operation
Create a new "Contact" using a dropdown list from the ExposureResults class (which will have data predefined), and read it back. I got the dropdown working, what I'm stuck is making the relation work, so when I get the "ExposureResultID" property, I grab the "ExposureResult" property from ExposureResults Table.
I've tried to access it like this:
And haven't managed to get the correct display.
Any ideas?
Thanks a million! :D
Link to comment
https://www.neowin.net/forum/topic/1232755-setting-up-navigation-properties-and-retrieving-info-in-entity-framework-and-mvc-5/Share on other sites
3 answers to this question
Recommended Posts