gpt4 book ai didi

NHibernate Projections - 如何投影集合

转载 作者:行者123 更新时间:2023-12-04 19:15:12 24 4
gpt4 key购买 nike

有一个场景,我只需要从实体中选择一个/几列,但在查询中选择多个子项。
我一直在尝试预测,但在集合属性上出现错误。这是一种正常情况,但无法找到有关投影集合的信息 - 只有属性。

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

关于NHibernate Projections - 如何投影集合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10563804/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com