nhibernate / nhibernate-core

NHibernate Object Relational Mapper
https://nhibernate.info
GNU Lesser General Public License v2.1
2.13k stars 925 forks source link

QueryOver throw Could not determine member type from Constant #2801

Open pasqualedante opened 3 years ago

pasqualedante commented 3 years ago

if I execute this statement the exception stated in subject is throw: var jk = session.QueryOver<T>().Where(x => 1 == 1).Take(1);

if I execute this statement via ::Query and not via ::QueryOver all works fine:
var jk = session.Query<T>().Where(x => 1 == 1).Take(1);

This differtent behavior is by design?

Thanks in advance.

bahusoid commented 3 years ago

I don't think it's by design - simply not implemented. My guess it would work parametrized:

var v = 1;
var jk = session.QueryOver<T>().Where(x => v == 1).Take(1);