I have two Entities: GrmDeploymentAttempt and GrmDeploymentStep. These entities have a many to many relationship through an intermediary POCO GrmDeploymentAttemptStep, which has additional information about the actual many-to-many relationship.
I am trying to load an attempt with all step information through eager loading, so right now I have the following code:
var attempt = _context.GrmDeploymentAttempts
.Where(x => x.Id == attemptId)
.Include(x => x.AttemptSteps)
.FirstOrDefault();
The problem is this eager load the intermediary table, but doesn’t eager load the Steps table. How can I use the Include() with expressions to eager load my Step entity? Using the Include(string) method I could do Include("AttemptSteps.Steps") but I am not sure how to do this with expressions.
As a note, I know i could instead load the AttemptSteps entity and eager load off of there, but there are some situations where I am unable to do this and I have been wondering how to handle this.
Include(...Select(...))generally loads a navigation property of a child collection.