我有一个包含多个连接的查询。我的第一个查询运行良好,但是当我想在第二个联接中使用此结果 (IQueryable) 时,出现错误。如何在第二个查询中使用我的第一个结果对象?
谢谢!
ISession session = NHibernateSessionManager.Instance.GetSession(SessionFactoryConfigPath);
IQueryable<Approval> approvals = session.Query<Approval>();
IQueryable<Ticket> tickets = session.Query<Ticket>()
.Where(t => t.Canceled == null
&& t.IsNotified == null);
IQueryable<Notification> notifications = session.Query<Notification>();
var qry = approvals.Join(tickets,
a => a.TicketID,
t => t.ID,
(a, t) => new { Ticket = t, Approval = a });
//here I want to use my IQueryable<Anonymous> object to create my second join.
qry = notifications.Join(qry,
n => n.DatabaseID,
anon => anon.Ticket.DatabaseID,
(n, anon) =>
new {Ticket = anon.Ticket,
Approval = anon.Approval,
Notification = n});