エンティティから1つまたは複数の列を選択する必要があるが、クエリの複数の子のみを選択する必要があるシナリオがあります。 私は投影を試みていますが、コレクションのプロパティでエラーが発生しています。このような通常の状況ですが、コレクションのコレクションに関する情報は見つけることができません。NHibernate Projections - コレクションをプロジェクトする方法
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
[NHibernateのQueryOverの予測 - DTOにコレクションを投影]の可能な複製(http://stackoverflow.com/questions/10535961/nhibernate-queryover-projections-projecting-collections-to-dto) – Baz1nga
質問を繰り返さないでください... – Baz1nga
2つのプロパティを選択しました。リスト