Subsonic 亚音速3.0左连接

Subsonic 亚音速3.0左连接,subsonic,subsonic3,Subsonic,Subsonic3,尝试使用linq在亚音速中进行左连接,但似乎不起作用,我得到了一个很大的错误 我非常确定这个查询是正确的,因为我已经用objects和Linq2Sql做过几次了 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

尝试使用linq在亚音速中进行左连接,但似乎不起作用,我得到了一个很大的错误

我非常确定这个查询是正确的,因为我已经用objects和Linq2Sql做过几次了

            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};
似乎亚音速无法从左连接linq查询生成所需的SQL

我做错什么了吗?附近有工作吗

更新:我使用的是亚音速3.0.0.2,这是我在尝试使用亚音速左连接时遇到的错误


类型“System.Collections.Generic.IEnumerable
1[GetAQuote.Post]”的表达式不能用于方法“System.Linq.IQueryable
1[GetAQuote.Post]”的类型“System.Linq.IQueryable
1[f_u匿名类型2
2[GetAQuote.Post,System.Collections.Generic.IEnumerable
1[GetAQuote.Quote]]GroupJoin[Post,Quote,Int32,f_uAnonymousType2
2](System.Linq.IQueryable
1[Getakote.Post],System.Collections.Generic.IEnumerable
1[Getakote.Quote],System.Linq.Expressions.Expression
1[System.Func
2[Getakote.Post,System.Int32]],System.Linq.Expressions
1[System.Func
2[Getakote.Quote,System.Int32]],System.Linq.Expressions.Expression
1[System.Func
3[getakote.Post,System.Collections.Generic.IEnumerable
1[getakote.Quote],f_u匿名类型2
2[getakote.Post,System.Collections.Generic.IEnumerable`1[getakote.Quote]]“

我认为这是一个bug,亚音速不支持它。我在做其他事情时也遇到了同样的问题

我有一个左连接叉,我将在未来几天内使用它-给我一周的时间,我将推出另一个版本。

似乎还没有解决这个问题的方法。一个简单的解决方法(尽管有点脏)创建一个视图,该视图处理左侧连接,并用默认数据填充右侧的空数据,并让亚音速在该视图上执行简单连接


我知道这很糟糕,但它现在是一个修复程序。由于这个限制,我看不到亚音速会下降。我相信它很快就会被修复。

在这里恢复一个旧主题,但是对于那些后来搜索的人,对于左外连接,亚音速3中有一个不同的语法似乎可以正确工作

而不是原始帖子中的Linq表达式:

        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};
将其改写为:

        var post = from p in Post.All()
                    from q in Quote.All().Where(x => x.PostID == p.ID).DefaultIfEmpty()
                    where p.ID == id.Value
                    select new {p, q};

希望这对某人有所帮助!

请发布您看到的重大错误的详细信息。这也是3.0.0.2版的错误。是的,我正在使用3.0.0.2。我已经用错误消息更新了帖子。您使用的是哪种模板?我也需要修复此错误。它似乎仍然不起作用!谢谢!10多个月后…仍在试图找出解决方法左加入亚音速。我猜我只是被迫往返几次…男孩亚音速对我们的发展时代来说真的是一个净的积极因素…/sarcasmI停止使用亚音速。它似乎和DAL结婚了(不仅仅是亚音速)这比方便更让人头痛,这将是我的死亡。我回到了SQL和Datatables的简单方法,在JSON处理程序中添加了datatable,这让我更开心。祝你好运!