【发布时间】:2010-03-27 13:42:46
【问题描述】:
我正在尝试使用 linq 在 subsonic 3 中进行左连接,但它似乎不起作用,我遇到了一个大错误。
var post = from p in Post.All()
join q in Quote.All() on p.ID equals q.PostID into pq
where p.ID == id.Value
from qt in pq.DefaultIfEmpty()
select new {p, qt};
我正在使用 Rob 提供的最新 GIT 版本的 subsonic 3,但是当我尝试左连接时出现错误,请参见下文。 我已经搜索过,但没有找到任何解决方案。
谁能向我解释为什么会出现错误以及如何解决它? 谢谢
Expression of type 'System.Collections.Generic.IEnumerable1[GetAQuote.Post]' cannot be used for parameter of type 'System.Linq.IQueryable1[GetAQuote.Post]' of method 'System.Linq.IQueryable1[<>f__AnonymousType221[GetAQuote.Post], System.Collections.Generic.IEnumerable1%5BGetAQuote.Quote%5D, System.Linq.Expressions.Expression1[System.Func2%5BGetAQuote.Post,System.Int32%5D%5D, System.Linq.Expressions.Expression1[System.Func2%5BGetAQuote.Quote,System.Int32%5D%5D, System.Linq.Expressions.Expression1[System.Func3%5BGetAQuote.Post,System.Collections.Generic.IEnumerable1[GetAQuote.Quote],<>f__AnonymousType22%5BGetAQuote.Post,System.Collections.Generic.IEnumerable1%5BGetAQuote.Quote%5D%5D%5D%5D">GetAQuote.Post,System.Collections.Generic.IEnumerable1[GetAQuote.Quote]]] GroupJoin[Post,Quote,Int32,f__AnonymousType22 '`
【问题讨论】: