繁体   English   中英

LINQ,聚合操作不支持“System.Data.Linq.Binary”类型

[英]The type 'System.Data.Linq.Binary' is not supported in aggregation operations - LINQ

 (from chapter in Chapters
        join userChapter in UserChapters on chapter.Id equals userChapter.ChapterId
        join pub in Publications on chapter.Id equals pub.ChapterId into P 
        from publication in P.DefaultIfEmpty()
        where userChapter.UserId == 9
        group new
                           {
                               PubID = publication.Id,
                               Logo = chapter.Logo
                           } by new { chapter.Id, chapter.Name} into x
                           orderby x.Key.Name
        select new 
       {
           Id = x.Key.Id,
           chapterName = x.Key.Name,
           PublicationCount = x.Count(z => z.PubID > 0),
           Logo = x.Max(z=>z.Logo)
       }
)

在上面的查询中,“ chapter.Logo ”的类型为byte[] ,当我尝试执行此查询时,我收到以下错误。

LINQ,聚合操作不支持“System.Data.Linq.Binary”类型。

    (from chapter in Chapters
    join userChapter in UserChapters on chapter.Id equals    userChapter.ChapterId
    join pub in Publications on chapter.Id equals pub.ChapterId into P 
    from publication in P.DefaultIfEmpty()
    where userChapter.UserId == 9
    group new
                       {
                           PubID = publication.Id,
                           Logo = chapter.Logo
                       } by new { chapter.Id, chapter.Name} into x
                       orderby x.Key.Name
    select new 
   {
       Id = x.Key.Id,
       chapterName = x.Key.Name,
       Logo = x.Max(z=>z.Logo.Count())
   }

    (from chapter in Chapters
    join userChapter in UserChapters on chapter.Id equals    userChapter.ChapterId
    join pub in Publications on chapter.Id equals pub.ChapterId into P 
    from pub in P.DefaultIfEmpty()
    where userChapter.UserId == 9
    group pub by new { chapter.Id, chapter.Name,chapter.Logo,pub.Id} into x
                       orderby x.Key.Name
    select new 
   {
       Id = x.Key.Id,
       chapterName = x.Key.Name,
       Logo = x.Key.Logo,
   PublicationCount=x.Count()
   }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM