O
O
one__for__one2019-01-14 15:33:25
C++ / C#
one__for__one, 2019-01-14 15:33:25

How to load data using include of other levels using entity fraimwork?

Hello, I figured out how to load data for the first 3 levels of an object, I can’t access a specific object at level 4 - it turns out that I’m accessing a list of objects.
5c3c814d6eab6517513681.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Pavlov, 2019-01-14
@one__for__one

In one Include, you can immediately show several nested links, then all intermediate ones will also be connected:

return (from e in db.Position
    .Include(p => p.Operations.Select(o => o.Transition.Select(t => t.RiggingTransition)))
    .Include(p => p.Operations.Select(o => o.MaterialOperation))
    where ...
    select e).ToList();

In this case, MaterialOperation and Transition should be connected in Position, in which RiggingTransition will be connected

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question