• ef左联三张表案例


     users:用户表

    Orderss:订单表

    U_O:用户和订单的中间表

    OrdersEntities1 oe = new OrdersEntities1();
                var result = from user in oe.Users
                             join o_u in oe.U_OC
                             on user.Id equals o_u.UId into o_uList
                             from o_u1 in o_uList.DefaultIfEmpty()
                             join o in oe.Orderss
                             on o_u1.OId equals o.Id into o_u1List
                             from o_u2 in o_u1List.DefaultIfEmpty()
                             select new
                             {
                                 user.Name,
                                 OrderName=o_u2.Name
                             };

  • 相关阅读:
    linux 学习随笔-shell基础知识
    linux 学习随笔-压缩和解压缩
    解析xml的4种方法详解
    集合工具类
    Map概述
    List集合概述
    Java集合框架
    Spring JdbcTemplate详解
    关于c3p0数据库连接池的简单使用
    Java通过JDBC封装通用DAO层
  • 原文地址:https://www.cnblogs.com/guozefeng/p/3472968.html
Copyright © 2020-2023  润新知