Linq 亚音速3中的左连接
我正在尝试使用linq在亚音速3中进行左连接,但它似乎不起作用,我得到了一个很大的错误Linq 亚音速3中的左连接,linq,subsonic3,left-join,Linq,Subsonic3,Left Join,我正在尝试使用linq在亚音速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(
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版本亚音速3,但当我尝试左连接时,我遇到了一个错误,请参见下文。
我已经搜索过了,但没有找到任何解决办法
有人能向我解释为什么会出现错误以及如何修复它吗?
谢谢
类型“System.Collections.Generic.IEnumerable1[getakote.Post]”的表达式不能用于方法“System.Linq.IQueryable1[getakote.Post]”的类型“System.Linq.IQueryable1[f_uanonymoustype221[getakote.Post],System.Collections.Generic.IEnumerable1%5bgetakote.Quote%5D,System.Linq.Expressions.Expression1”的参数[System.Func2%5GetQuote.Post,System.Func3%5GetQuote.Post,System.Linq.Expressions.Expression1[System.Func2%5GetQuote.Quote,System.Int32%5D%5GetQuote.Expressions.Expression1[System.Func3%5GetQuote.Post,System.Collections.Generic.IEnumerable1],f_uu匿名类型22%5GetAkote.Post,System.Collections.Generic.IEnumerable
1%5GetAkote.Quote%5D%5D%5D>GetAkote.Post,System.Collections.Generic.IEnumerable1[GetAkote.Quote]]GroupJoin[Post,Quote,Int32,f_u匿名类型22'要解决亚音阶中的左连接问题,只需在linq查询中设置.AsEnumerable()方法
试试这个
categories.AsEnumerable()或products.AsEnumerable()当我尝试此操作时,我克服了错误,但结果数据库活动是从两个表中全选,显然所有的连接逻辑都要在core中完成。这不对,是吗?@Kelly,我一直在研究亚音速3的核心,是的,这似乎就是正在发生的事情。
。可计算的
显然是equivalent to.ToList
,因为它完全可以从数据库中获取所有信息。此外,亚音速中似乎没有任何代码可以处理嵌套查询