i have following (working) code:
list<location> alllocations = new list<location>(); using (mycontext context = new mycontext()) { login currentlogin = getcurrentlogin(context); if (currentlogin != null) { foreach (var customer in currentlogin.customers) { alllocations.addrange(customer.locations); } } } return alllocations.asqueryable(); mycontext , objects live within entity framework. customers , locations icollection<>-properties
this code works expected, returning locations users' customers
but can see, add entity customer.locations list.
at end of function return generated list iqueryable able continue using linq-expressions on result.
because of performance reasons skip list<>-step , stay inside iqueryable
is possible?
change list<location> alllocations iqueryable<location> alllocations.
then can alllocations = currentlogin.customers.selectmany(c => c.locations).asqueryable().
Comments
Post a Comment