Closed
Description
Could someone please look if it's a bug?
NHibernate 5.2.6 (net.core)
Dialect: NHibernate.Dialect.MsSql2008Dialect
Driver: NHibernate.Driver.SqlClientDriver,NHibernate
Db: MSSQL 14.0.2027.2
The following query throws an exception:
queryOver
.Select(new[]
{
Projections.Property(() => root.Id).WithAlias(() => vm.Id),
Projections.Property(() => root.FullName).Coalesce(Projections.Property(() => root.UserName)).WithAlias(() => vm.Name),
});
The exception is:
System.InvalidOperationException: Not to be used directly - use inside QueryOver expression
at NHibernate.Criterion.ProjectionsExtensions.Coalesce[T](T objectProperty, T replaceValueIfIsNull)