I have a question regarding entity framework queries.
I have a query which is using the Extension methods provided by EF, so i can use type safe includes and where clause. But as the Include is with a lambda parameter it is an extension method on IQueryable that returns an IQueryable in order to chain methods like Where. Include with a string parameter is a method on ObjectQuery that returns an ObjectQuery. Execute is a method on ObjectQuery, not IQueryable so it is not available when you use IQueryable methods.
Is there a way to call .Execute but with IQueryable?
return
this.Storage.Customer.OfType<Preferred>()
.Include(b => b.Order)
.Where(cust => cust.Id == customerId && cust.CustomerType== (int)cusType)
.SingleOrDefault();
Thanks,
I have found it, maybe someone can comment if this is good practice or not?