zoukankan      html  css  js  c++  java
  • LINQ 嵌套查询

    直接代码:

    //获取教材下的章跟篇
                IList<Chapter> chapters =
                    EntAppFrameWorkContext.DomainModelService.ExtenedService<IEbookManage>()
                        .SearchChapterAndPartByEbookId(ebook.Key);
    
                Dictionary<Chapter,IList<KeyToChaSec>> dictionary=new Dictionary<Chapter, IList<KeyToChaSec>>();
                //根据章跟篇获取可用的知识点目录关系
                foreach (var chapter in chapters)
                {
                    IList<KeyToChaSec> keyToChaSecs =
                        EntAppFrameWorkContext.DomainModelService.ExtenedService<IEbookManage>()
                            .SearchAllValidKeyToChaSecByChapterOrPart(chapter.Key);
                    dictionary.Add(chapter,keyToChaSecs);
                }
                var jsons = from dic in dictionary
                            select new
                            {
                                ChapterID=dic.Key.Key,
                                ChapterName=dic.Key.Name,
                                KnowledgePoints=(
                                from keyToChaSec in dic.Value
                                select new
                                {
                                    ID = keyToChaSec.KeyPoint.Key,
                                    KnowledgePointRef =
                                        @"xhtml/" + keyToChaSec.ChpSect.PositionPage.Key + ".xhtml#kp" + keyToChaSec.KeyPoint.Key,
                                    ChapterName = keyToChaSec.ChpSect.Name,
                                    ChapterID = keyToChaSec.ChpSect.Key,
                                    KnowledgePoint = keyToChaSec.KeyPoint.Name
                                })
                            };
    

      

  • 相关阅读:
    shell 算术运算符
    shell 关系运算符
    shell 布尔运算符
    shell逻辑运算符
    shell 字符串运算符
    shell 文件测试运算符
    shell 运算符
    shell 循环总结
    Shell echo命令
    利用WHID为隔离主机建立隐秘通道
  • 原文地址:https://www.cnblogs.com/ddddai/p/4325470.html
Copyright © 2011-2022 走看看