我有一个查询得到Child
对象的一个Parent
对象。
我需要将结果转换为List<KeyValuePair<int, int>>
无法弄清楚。nhibernate投影到匿名类型
Child childAlias = null;
Parent parentAlias = null;
int[] parentIds = new int[]{1,2,3};
var temp = sess.QueryOver<Parent>()
.JoinQueryOver(p => p.Children,() => childAlias)
.Where(c => c.Parent.Id.IsIn(parentIds))
.Select(Projections.ProjectionList()
.Add(Projections.GroupProperty(Projections.Property<Parent>(x => x.Id)))
.Add(Projections.Count(() => childAlias.Id)))
.List<object[]>();
我需要这个List<object[]>
是一个List<KeyValuePair<int, int>>
我知道它涉及与annonymous对象Select
,但无法弄清楚
当你调试它,什么是在'temp'项目的实际类型? –
用'List'声明了它的一个对象数组的列表,没有'List'它的一个'IQueryOver' –
heyNow