[EntityFramework Core] Populate complex object from query with join
Hi,
I've the following objects representing tables:
I'd like to retrieve the list of all ProductionOrder items together with their Product and Customer.
From what I've experimented, the following code returns the ProductionOrder list but Customer and Product fields are both null:
Of course I could manually perform a couple of query for each ProductionOrder, retrieving its Product and Customer. But it seems a waste of resources, since with JOIN I can achieve the same result with a single query.
So I'm trying to understand if the above code can somehow perform JOIN and retrieve Product and Customer automatically or if I'm required to perform JOIN manually.
Thanks
1 Reply
In the end I was able to solve the problem: I just need to use
et voilà, Customer and Product fields are filled automatically. That's very nice. It took me about an entire working day to figure it out 😓