I may be being stupid but never seem to get anything showing in the 'lambda window' after running code. Can anyone explain how it is supposed to work?
If you write a query using query syntax, the lambda window will translate the query into method syntax.
Try running the sample "What about LINQ to SQL?" in the LINQPad 5 minute induction* folder in the samples tab. (induction = LINQPad typo, not mine!)
Your code window will look like this:
from p in Products
let spanishOrders = p.OrderDetails.Where (o => o.Order.ShipCountry == "Spain")
where spanishOrders.Any()
orderby p.ProductName
select new
{
p.ProductName,
p.Category.CategoryName,
Orders = spanishOrders.Count(),
TotalValue = spanishOrders.Sum (o => o.UnitPrice * o.Quantity)
}
and the lambda window will look like this:
Products
.Select (
p =>
new
{
p = p,
spanishOrders = p.OrderDetails.Where (o => (o.Order.ShipCountry == "Spain"))
}
)
.Where (temp0 => temp0.spanishOrders.Any ())
.OrderBy (temp0 => temp0.p.ProductName)
.Select (
temp0 =>
new
{
ProductName = temp0.p.ProductName,
CategoryName = temp0.p.Category.CategoryName,
Orders = temp0.spanishOrders.Count (),
TotalValue = temp0.spanishOrders.Sum (o => (o.UnitPrice * (Decimal?)(o.Quantity)))
}
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With