Expand|Select|Wrap|Line Numbers
- var query = from c in db.Categories
- join pc in db.ProductsToCategories on c.ID equals pc.CategoryID
- where pc.ProductID == productID
- orderby c.Name ascending
- select c;
So I want to strip the join and the where out of the query and add it back in with deferred calls to .Join and .Where only if required.
However I am having a problem with the where (haven't tried the join yet)
Expand|Select|Wrap|Line Numbers
- var query = from c in db.Categories
- join pc in db.ProductsToCategories on c.ID equals pc.CategoryID
- orderby c.Name ascending
- select c;
- query = query.Where(pc => pc.ProductID);
How do I reference the joined table in a deferred Where call?
Thanks
Dan