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.
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