在Subsonic 3中左加入

编程入门 行业动态 更新时间:2024-10-26 20:23:32
本文介绍了在Subsonic 3中左加入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用linq在亚音速3中进行左联接,但似乎不起作用,我遇到了一个大错误.

I'm trying to do a left join in subsonic 3 using linq but it doesn't seem to work, I get a big error.

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,但尝试左连接时出现错误,请参见下文. 我已经搜索过,但是没有找到任何解决方案.

I'm using subsonic 3, latest GIT version from Rob, but I'm getting an error, see below, when I try a left join. I have searched but I didn't found any solution.

谁能向我解释错误的原因以及如何解决? 谢谢

Can anyone explain to me why the error and how to fix it? Thanks

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.IEnumerable 1%5BGetAQuote.Quote%5D%5D%5D%5D> GetAQuote.Post,System.Collections.Generic.IEnumerable1 [GetAQuote.Quote]]] GroupJoin [Post,Quote,Int32,<> f__AnonymousType22'`

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'`

推荐答案

要解决Subsonic3中的Left Join,您只需要在linq查询中设置.AsEnumerable()方法即可.

to solve Left Join in Subsonic3 you just need to set .AsEnumerable() method on your linq query.

尝试一下

categories.AsEnumerable()或products.AsEnumerable()

categories.AsEnumerable() or products.AsEnumerable()

更多推荐

在Subsonic 3中左加入

本文发布于:2023-11-06 16:05:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564161.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Subsonic

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!