I have the following linq expression in lambda syntax:
var myValue = 6;
var from = 2;
var to = 8;
var res = MyList.Where(m => m.person.Id == person.Id
&& IsBetween(myValue, from, to))
.Select(x => new Person { blah blah blah })
.ToList());
IsBetween is simple generic helper method to see whether I have something in between:
public bool IsBetween<T>(T element, T start, T end)
{
return Comparer<T>.Default.Compare(element, start) >= 0
&& Comparer<T>.Default.Compare(element, end) <= 0;
}
Now I get this error, and I don't know hot to get around it:
LINQ to Entities does not recognize the method 'Boolean IsBetween[Decimal](System.Decimal, System.Decimal, System.Decimal)' method, and this method cannot be translated into a store expression.