开发者

Left Join in Subsonic3

开发者 https://www.devze.com 2022-12-22 02:33 出处:网络
I\'m new in subsonic3, and I\'m getting some errors when I try to use LeftJoin var q = from c in categories

I'm new in subsonic3, and I'm getting some errors when I try to use 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 };

The error is "System.Collections.G开发者_如何转开发eneric.Enumerable '...' cannot be used for parameter of type System.Linq.IQueryable

Does anyone had this error before? Did you fix it? Thanks


I don't know which one is the IQueryable property but you probably know, just add the .AsEnumerable() method.

categories.AsEnumerable() or products.AsEnumerable()

I cant remember if you had to add the toList() method also but you can try it out.

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

精彩评论

暂无评论...
验证码 换一张
取 消