Fix eager includes not working

This commit is contained in:
2023-10-28 23:22:58 +02:00
parent a36ada6765
commit 17fc22cdb4
2 changed files with 15 additions and 0 deletions

View File

@@ -200,6 +200,18 @@ namespace BasicSample
Console.WriteLine($"Our users bought the following products starting with 'Red': {string.Join(", ", result.Ordered)}");
}
{
var ret = dbContext.Users
.Include(x => x.Orders)
.ThenInclude(x => x.Items)
.ThenInclude(x => x.Product)
.First();
Console.WriteLine($"User name: {ret.FullName}, Orders: {string.Join(", ", ret.Orders
.SelectMany(x => x.Items
.Select(y => y.Product.Name)
))}");
}
}
}
}