EFCore 一对多连接查询

内容纲要

A对B、C

await (from e in _context.Equip
                          join c in _context.Ycp
                          on e.EquipNo equals c.EquipNo into j1
                          join x in _context.Yxp
                          on e.EquipNo equals x.EquipNo into j2
                          select new
                          {
                              Equips = e,
                              Ycs = j1.ToList(),
                              Yxs = j2.ToList()
                          }).ToListAsync();
点赞
  1. geodon说道:

    My husband and i felt now excited Emmanuel could conclude his inquiry from your ideas he gained in your site. It's not at all simplistic just to choose to be giving for free ideas that most people have been making money from. And we all do understand we have the website owner to be grateful to because of that. The explanations you've made, the easy site menu, the friendships you can give support to engender - it's everything powerful, and it's really leading our son in addition to the family reason why the subject is fun, which is really pressing. Thank you for the whole lot!

  2. 痴者工良说道:

    :razz: 测试了,EF Core 3.x 以上,如果不能生成一条SQL,生成的是多条 SQL,就会报异常。
    而且复杂SQL使用 EF Core 十分不爽,所以我换成 Dapper 了。。。
    简单查询,增删查改 使用 EFCore;
    复杂查询使用 Dapper。
    省下的时间可用去陪妹子。

发表评论

邮箱地址不会被公开。 必填项已用*标注

You must enable javascript to see captcha here!