Cannot convert expression type 'NHibernate.IQueryOver<T,T>' to return type 'System.Linq.IQueryable<T>'

£可爱£侵袭症+ 提交于 2019-12-11 03:28:51

问题


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);
    }

回答1:


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



来源:https://stackoverflow.com/questions/11852211/cannot-convert-expression-type-nhibernate-iqueryovert-t-to-return-type-syst

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!