It works though, I'm not very interested in the first one.
Customer foundCustomer = context.Set<Customer>().Include(e => e.Orders.Select ( d => d.OrderLines)).FirstOrDefault();
This works, and I find a match I'm working on.
string custKey = "VINET"; Customer foundCustomer = context.Set<Customer>().Include(e => e.Orders.Select(d => d.OrderLines)).Where(c => c.CustomerID.Equals(custKey, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
This works and reads db as I want, but does not have the inclusions that I want.
Customer foundCustomer = context.Set<Customer>().Find(custKey);
This does not work ... but this is what I actually after
Customer foundCustomer = context.Set<Customer>().Include(e => e.Orders.Select(d => d.OrderLines)).Find(custKey);
Is there a way to combine Include() with Find() ?
Here is the context. Typical Northwind Customer / Order (s) / OrderDetails script.
public partial class WindyContext : DbContext { static WindyContext() {
entity-framework
granadaCoder
source share