I had a similar query to LINQ: How to remove element from IQueryable<T> and for the most part it answered my question.
My code is set up similarly:
var items = MyDataContext.Items.Where(x =>MyFunction(x.value1, x.value2, x.value3));
...
...
bool MyFunction(decimal val1, decimal val2, decimal val3)
{
//some calculation with the parameters
return true;
}
It compiles fine, but when I run it, it throws an error:
"An exception of type 'System.NotSupportedException' occurred in System.Data.Entity.dll but was not handled in user code
Additional information: LINQ to Entities does not recognize the method 'Boolean MyFunction(System.Decimal, System.Decimal, System.Decimal)' method, and this method cannot be translated into a store expression."
I'm new to linq, only started this week, so any help is appreciated. Thanks!