NHibernate Linq DateTime in Where-Clause not supported?
I try to use the fallowing query to g开发者_高级运维et all companies, which are created after a specific date:
return session.Query<Company>().Where(x => x.Created > value)
When I execute this, I always get a System.NotSupportedException. When I remove the Where(), it is working. I use NHibernate 3.0. Does Linq in NH3.0 not support such Where-clauses? How can I do this instead?
I have found the problem:
I have also a Skip() and a Take() used. This two has to be after the Where().
The problem is not NH3 supporting where with NH3 you should be using QueryOver and not Query. So it should be
return session.QueryOver<Company>().Where(right condn);
whats the type of created in your query and i may be able to help
You can have the skip and take too that is totally fine.
精彩评论