Entity Framework: loading second-level navigation properties

I have the following three tables:

Customers: I would have ClientName

Projects: I would clientid (int ref to Clients.id) the name of the project projectstatus (int ref to ProjectStatuses.id)

ProjectStatuses: I would have statusname

I select one client and, if necessary, load the selected client projects as follows:

selectedClient.Projects.Load ();

but how do I upload it the project status file?

+3
source share
1 answer
selectedClient.Projects.ProjectStatuses.Load()

Edit

This is a one-to-many relationship that I think

it should work

selectedClient.Projects.First().ProjectStatuses.Load()

or you can also load it directly into your request using

context.Clients.Include("Projects.ProjectStatuses");
+4
source

Source: https://habr.com/ru/post/1775258/


All Articles