zoukankan      html  css  js  c++  java
  • ef导航属性

    https://msdn.microsoft.com/en-us/data/jj574232.aspx 
    场景是   A表中有B,B表中又C。都是一堆多的关系。怎样Mapping是个问题啊。
     var blogs1 = context.Blogs 
                           .Include(b => b.Posts.Select(p => p.Comments)) 
                           .ToList(); 

    // Load all blogs, all related posts, and all related comments 
        var blogs1 = context.Blogs 
                           .Include(b => b.Posts.Select(p => p.Comments)) 
                           .ToList(); 
     
        // Load all users their related profiles, and related avatar 
        var users1 = context.Users 
                            .Include(u => u.Profile.Avatar) 
                            .ToList(); 
     
        // Load all blogs, all related posts, and all related comments  
        // using a string to specify the relationships 
        var blogs2 = context.Blogs 
                           .Include("Posts.Comments") 
                           .ToList(); 
     
        // Load all users their related profiles, and related avatar  
        // using a string to specify the relationships 
        var users2 = context.Users 
                            .Include("Profile.Avatar") 
                            .ToList(); 
     


    returnValue=context.Assessments.Where(item=>item.State== AssessmentType.Used).Include(item=>item.QuestionList.Select(p=>p.Options)).ToList();

  • 相关阅读:
    Day015 PAT乙级 1013 数素数
    Day014 PAT乙级 1012 数字分类
    Day013 PAT乙级 1007 素数对猜想
    Day012 PAT乙级 1005 继续(3n+1)猜想
    Day011 PAT乙级 1003 我要通过
    Day010 PAT乙级 1002 写出这个数
    Day009 洛谷 P5707 上学迟到
    Day008 洛谷 P2181 对角线
    Day007 Java异常处理
    Fetch()
  • 原文地址:https://www.cnblogs.com/wcLT/p/4730691.html
Copyright © 2011-2022 走看看