OrderBy排序1,2,0,0,0,0

Posted 鞍山老菜鸟

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OrderBy排序1,2,0,0,0,0相关的知识,希望对你有一定的参考价值。

OrderBy排序1,2,0,0,0,0

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

 

以上是关于OrderBy排序1,2,0,0,0,0的主要内容,如果未能解决你的问题,请参考以下文章

为啥代码片段在 matplotlib 2.0.2 上运行良好,但在 matplotlib 2.1.0 上引发错误

Realm和RecyclerView项目排序和自动ViewPager片段通信

mssql 判断 排序

以下代码片段的时间复杂度是多少?

LeetCode810. 黑板异或游戏/455. 分发饼干/剑指Offer 53 - I. 在排序数组中查找数字 I/53 - II. 0~n-1中缺失的数字/54. 二叉搜索树的第k大节点(代码片段

vue2.0 代码功能片段