lambda表达式排序var sql_BusinessInformation = db.BusinessInformation .OrderBy(d => d.sort == 0 ? int.MaxValue : d.sort).ThenByDescending(d => d.createtime)
生成的sql语句
.OrderBy(d => d.sort == 0 ? int.MaxValue : d.sort) 转意为: CASE WHEN (0 = [Extent1].[sort]) THEN 2147483647 ELSE [Extent1].[sort] END AS [C1]
SELECT c1, [Project1].[id] AS [id], [Project1].[sort] AS [sort], [Project1].[createtime] AS [createtime] FROM ( SELECT CASE WHEN (0 = [Extent1].[sort]) THEN 2147483647 ELSE [Extent1].[sort] END AS [C1], [Extent1].[id] AS [id], [Extent1].[createtime] AS [createtime] FROM [dbo].[BusinessInformation] AS [Extent1] WHERE 0 = [Extent1].[isExamine] ) AS [Project1] ORDER BY [Project1].[C1] ASC, [Project1].[createtime] DESC
时间: 2024-10-10 07:55:34