There is a scenario in which I need to select only one / several columns from the object, but several children in the query. I tried with projections, but got an error in the property of the collections. This is such a normal situation, but cannot find information on designing collections - only properties.
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:
System.IndexOutOfRangeException : Index was outside the bounds of the array
source
share