Hello, everybody. I know, that this topic has been discussed yet. But, unfortunately, I didn't find any solution in existing answers.So, I have the next code:
public List<List<string>> DataTableParser(IQueryable<T> queriable)
{
//I missed the unnecessary code
return queriable.Select(SelectProperties).ToList();
//I missed the unnecessary code
}
private Expression<Func<T, List<string>>> SelectProperties
{
get
{
var properties = typeof(T).GetProperties();
//
return value => properties.Select
(
// empty string is the default property value
prop => (prop.GetValue(value, null) ?? string.Empty).ToString()
)
.ToList();
}
}
So, in the method DataTableParser I have the exception with the next message:
"Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains() operator".
I don't use in my query "where" part. So I can't imagine how to use "Contains" operator. And I can't understand the reason of the exception.
Does anyone have any ideas? I will appreciate any help. Thanks.