1
背景: 鑑於3個表使用NHibernate和QueryOver我怎麼能參加3個表
results contains 2 columns vId and pId
vTable contains 2 columns vId and data
pTable contains 2 columns pId and data
我要完成使用QueryOver
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
這種SQL查詢我試着如下:
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
我在做什麼錯?