【发布时间】:2011-08-17 05:06:06
【问题描述】:
背景: 给定3张桌子
results contains 2 columns vId and pId
vTable contains 2 columns vId and data
pTable contains 2 columns pId and data
我想使用 QueryOver 完成这种 SQL 查询
SELECT v.data, p.data
from results r
inner join vTable v on r.vId = v.vId
inner join pTable p on r.pId = p.pId
我尝试了以下方法:
var res = GetResults(some parameters)
.Select(x => x.vId
.Select(x => x.pID);
var dataset = session.QueryOver<vTable>()
.WithSubquery.WhereProperty(v => v.vId).In(res)
.Select(v => v.vId)
.Select(v => v.data)
从 vTable 获取数据效果很好
但是,当我添加第二个表时
var dataset = session.QueryOver<vTable>()
.WithSubquery.WhereProperty(v => v.vId).In(res)
.JoinQueryOver<pTable>(p => p.pId)
.WithSubquery.WhereProperty(p => p.pId).In(res)
.Select(v => v.vId)
.Select(v => v.data)
.Select(p => p.pId)
.Select(p => p.data)
我得到了错误
Delegate 'System.Func<System.Collections.Generic.IEnumerable<pTable>>' does not take 1 arguments
我做错了什么?
【问题讨论】:
标签: nhibernate fluent-nhibernate queryover