Skip to content

Instantly share code, notes, and snippets.

@jfromaniello
Created September 22, 2010 14:37
Show Gist options
  • Save jfromaniello/591783 to your computer and use it in GitHub Desktop.
Save jfromaniello/591783 to your computer and use it in GitHub Desktop.
//Ahora pensa en esta
var q = from c in categories
join p in products on c equals p.Category into ps
select new { Category = c, MaxQuantity = ps.Max(p => p.Quantity), ProductsCount = ps.Count() };
sin join:
//Forma sin join
var q = from c in categories
select new {
Category = c,
MaxQuantity = products.Where(p => p.Category == c).Max(p => p.Quantity),
ProductsCount = products.Count(p => p.Category == c)
};
//si vos decís que las dos deberían tener la misma performance...
//si vos decís que el QueryProvider debería funcionar igual.... Es probable que MS te pida que le expliques vos como hacer el parseo del expression tree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment