linq to sql Distinct and orderby

前端 未结 3 460
陌清茗
陌清茗 2020-12-20 10:54
var result = table1.Join(table2, o => o.ProgramID, t => t.ProgramID, (o, t) => new { o.ProgramID, t.Program })
         .OrderBy(t => t.Program)
                 


        
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-20 11:39

    Profile the two queries, comparing stats-IO and the actual execution plan. It is entirely possible that it makes zero difference to the SQL server.

    If you really want known TSQL, use ExecuteQuery-of-T and pass in the TSQL yourself. Maybe include some lock hints too (most commonly: NOLOCK)

提交回复
热议问题