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

  • 相关阅读:
    SQL注入漏洞
    回发或回调参数无效
    ListView绑定DataSet
    SQL注入漏洞全接触入门篇(二)
    条件运算符
    安全类
    ASP.NET常用代码集锦
    活动目录操作类
    x60系统安装步骤
    程序员是如何喝酒的
  • 原文地址:https://www.cnblogs.com/wcLT/p/4730691.html
Copyright © 2011-2022 走看看