asp.net mvc - Entity Framework not populating context -
I am starting with the discovery of some unit structure, I thought it was time that everyone was complaining Were. I am running on an issue where the institutions do not return any object reference. I have created the model with three tables from one database that link to each other.
Course Instructor Trainee
As relationships you are expecting: One course is related to multiple CanTeach entities and an instructor is also from many CanTeach institutions Can relate to I have added an Odata service in my project which also uses the same model. That's why I can run a question like
in the connector where a.Instructor.FirstName == "Barry" new {name = a.Instructor.FirstName + "" + a.Instructor.LastName Select, Course = a.Course.Name}
Using LINQPad without OData endpoint against the endpoint. However, when I do a simple query
public trainer GetInstructorFromID (int id) {return reference.Enstrator. Where (i = & gt; i.id == ID). FirstOrDefault (); }
The CanTeach list is empty. I know everything in the EF is lazy and it is possible that from my reference time I see the context of the object, although the object is trying to get the reference, as soon as the result of the query results and the empty object Context .
What am I doing?
Edit:
In addition to the response below I found that
return reference. "CanTeach"). Where (i = & gt; i.id == ID). Before and after default ();
Worked for people looking for a fluent API.
Include one word from the kantak
. Include in ("trainer") where a. Diff. First name == "Barry" new {name = A.Extension: choose first name "" + +Instructor.LastName, course = a.Course.Name}
Comments
Post a Comment