有一种情况,我只需要从一个实体中选择一个/几列,但在一个查询中选择多个子级。我一直在尝试预测,但在 collections 属性上出现错误。这是一种正常的情况,但无法找到有关投影集合的信息 - 只有属性。
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>();
返回的错误是:
System.IndexOutOfRangeException : Index was outside the bounds of the array