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
                                })
                            };
    

      

  • 相关阅读:
    vue 使用sass 和less
    生命周期函数以及vue的全局注册
    vue-router的简单实现原理
    vue的三种传参方式
    配置router列表
    vue传参二
    Gym 101933E(状态压缩+记忆化搜索)
    Gym 101933 A(dp)
    Gym 101775H(dp)
    Gym 101775 D (思维)
  • 原文地址:https://www.cnblogs.com/ddddai/p/4325470.html
Copyright © 2011-2022 走看看