有一个场景,我只需要从实体中选择单个/几列,但在查询中选择多个子项。
我一直在尝试投影,但在集合属性上出现错误。这是很正常的情况,但找不到有关投影集合的信息 - 仅属性。
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
在 NH 3.3 中无法完成。https://nhibernate.jira.com/browse/NH-3176 https://nhibernate.jira.com/browse/NH-3176
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)