エンティティから単一/少数の列のみを選択する必要があるが、クエリで複数の子を選択する必要があるシナリオがあります。投影を試しましたが、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