Hi folks,
I'm trying to do the following linq 2 sql extension method:
public static PagedList<T> ToPagedListOrNull<T>(this IQueryable<T> value,
int index,
int pageSize)
{
return value.Count() == 0
? null
: (value is PagedList<T> ? value as PagedList<T> :
new PagedList<T>(value, index, pageSize));
}
I keep getting the following error:
Method 'Boolean Contains(System.String)' has no supported translation to SQL.
I think it's erroring on the value.Count() == 0
bit .. i think.
Can someone tell me why this is?