How can I rewrite this linq query to Entity on with lambda expression?
I want to use let keyword or an equivalent in my lambda expression.
var r
Another option is to define this extension method:
public static class Functional
{
public static TResult Pipe(this T value, Func func)
{
return func(value);
}
}
Then write your query like this:
var results = Stores
.Where(store => store.Sales.Average(s => s.Price)
.Pipe(averagePrice => averagePrice < 500 && averagePrice > 250));