Ability to project collections using QueryOver

Description

Unable to project collections when using QueryOver:

Customer customerAlias = null;
Order orderAlias = null;
var list = _session.QueryOver<Customer>(() => customerAlias)
.JoinAlias(x => x.Orders, () => orderAlias, JoinType.LeftOuterJoin)
.Select(
Projections.Property(() => customerAlias.Name),
Projections.Property(() => customerAlias.Orders))//this is the issue
.List<object>();

Error returned is:
System.IndexOutOfRangeException : Index was outside the bounds of the array

Environment

None

Activity

Show:

Luis Fernando November 22, 2012 at 1:36 PM

I wonder if there is a recommended approach for this case, both in QueryOver or Linq provider, or if at least this is a feature considered for the future.

What if I only need a property (only one!) within the child collection, for example like this: "Employees.Orders.OrderDate"

Samuel Goldenbaum June 6, 2012 at 11:55 AM

Thanks for the note - so I can assume this is a feature request and not a bug?

Oskar Berggren June 6, 2012 at 11:41 AM

I can find no mention in the reference documentation that the feature "project a collection" exist in QueryOver or Criteria.

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created June 6, 2012 at 10:59 AM
Updated September 9, 2014 at 12:16 AM
Who's Looking?