linq to sql – This IQueryable<T> extension method has no supported translation to SQL :( – Education Career Blog

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?


Your query is wrong, in other words in ‘value’.

Try testing that separately to make sure it works. 🙂

Leave a Comment