其他分享
首页 > 其他分享> > EF INNER JOIN WHERE ORDER BY

EF INNER JOIN WHERE ORDER BY

作者:互联网

 

同时使用 join,where,order by.

UpdaterDbContext db = new UpdaterDbContext();
                 
                // 按 t_server 表的 seq ASC 排序,与 Form1 grid 顺序一致
                var lstRst =
                from serv in db.t_server
                join itemServ in db.t_item_server.Where(x => x.item_id == _itemId) on serv.server_id equals itemServ.server_id
                orderby serv.seq
                select itemServ;
                lstItemServer = lstRst.ToList();

-

标签:serv,lstRst,JOIN,EF,db,itemServ,server,WHERE,id
来源: https://www.cnblogs.com/runliuv/p/16317937.html