The problem is your method declaration:
public override IQueryable<T> CreateQuery<T>(Expression expression)
You're declaring a new type parameter T
in a generic method. That's not the same T
as the type parameter for the type. Change it to be a non-generic method:
public override IQueryable<T> CreateQuery(Expression expression)
(As an aside, your code will be easier to use if you use appropriate using
directives to avoid including so many fully-qualified type names in your code.)