2012-10-17 43 views
1

我需要通过以下方式LINQ2SQL排序顺序

DTO{ 
    id //nullable 
    name // not nullable 
} 

demodata 
entry1: Null/"TopItem" 
entry2: 1 /"Numer1" 
entry2: 3 /"Numer3" 
entry2: 2 /"Numer2" 

说我必须在上面标识为null,列名排序的所有其他条目的项目订购一些数据

能这样用LINQ2SQL完成?

回答

1

尝试这样:

from dto in context.DTO 
orderby !dto.id.HasValue, dto.name 
select dto 
+0

作品。太好了,谢谢 –