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

      

  • 相关阅读:
    适配器
    适配器
    哈希容器
    迭代器
    redis介绍
    9内核同步介绍
    Redis基础数据结构
    springCloud-Eureka源码分析
    zookeeper伪分布式集群环境搭建
    消息队列核心-如何保证消息不丢失
  • 原文地址:https://www.cnblogs.com/ddddai/p/4325470.html
Copyright © 2011-2022 走看看