We're updating the issue view to help you get more done. 

NH should not use projection when counting

Description

I have the following query:

1 2 3 4 5 var list = repositoy.Query<MyClass>.Select(domain => new MyDto() { Id = domain.Id, StringComma = string.Join(",", domain.MyList.Select(y => y.Name)) });

That works great:

1 list.ToList();

But if I try to get the Count I got an exception:

1 list.Count();

Exception

NHibernate.Hql.Ast.ANTLR.QuerySyntaxException

1 A recognition error occurred. [.Count[MyDto](.Select[MyClass,MyDto](NHibernate.Linq.NhQueryable`1[MyClass], Quote((domain, ) => (new MyDto()domain.Iddomain.Name.Join(p1, .Select[MyListClass,System.String](domain.MyList, (y, ) => (y.Name), ), ))), ), )]

I think NH should not use projection when counting

Environment

None

Status

Assignee

Unassigned

Reporter

Paulj

Components

Affects versions

4.0.3

Priority

Trivial