Wednesday, 20 September 2017

Cannot convert expression type 'NHibernate.IQueryOver' to return type 'System.Linq.IQueryable'

I'm sure I'm doing this wrong, but I've been picking at it for a while. I'm trying to implement an IRepository Find method, and I just can't seem to work out how. Any help would be greatly appreciated!
The following code gives me the red squiggly line with the error message posted as the question.
   IQueryable<T> IRepository<T>.Find(Expression<Func<T, bool>> predicate)
    {
        return sessionManager.OpenSession().QueryOver<T>().Where(predicate);
    }

You have to use .Query<T>() extension method instead.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Blog Archive