【问题标题】:Left Join in Subsonic3左加入 Subsonic3
【发布时间】:2010-03-29 18:47:02
【问题描述】:

我是 subsonic3 的新手,尝试使用 LeftJoin 时遇到一些错误

    var q =

    from c in categories

    join p in products on c equals p.Category into ps

    from p in ps.DefaultIfEmpty()

    select new { Category = c, ProductName = p == null ? "(No products)" : p.ProductName };

错误是 "System.Collections.Generic.Enumerable '...' 不能用于 System.Linq.IQueryable 类型的参数

以前有人遇到过这个错误吗?你修好了吗? 谢谢

【问题讨论】:

标签: subsonic subsonic3


【解决方案1】:

我不知道哪个是 IQueryable 属性,但您可能知道,只需添加 .AsEnumerable() 方法即可。

categories.AsEnumerable() or products.AsEnumerable()

我不记得您是否还必须添加 toList() 方法,但您可以尝试一下。

categories.AsEnumerable().toList() or products.AsEnumerable().toList()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-14
    • 2010-10-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多