Hello,
public class A
{
public bool Selected;
public DateTime CreateDate;
}
I have a collection of A, let call it Coll, i want to do:
Coll.Where(a => a.Selected).Concat(Coll.Where(a => !a.Selected)
.OrderBy(a => a.CreateDate))
This look great, but the result is the same if i remove the order part, because Linq is generating the following string
SELECT [t2].[Selected], [t2].[CreateDate]
FROM (
SELECT [t0].[Selected], [t0].[CreateDate]
FROM [dbo].[A] AS [t0]
WHERE ([t0].[Selected] = 1)
UNION ALL
SELECT [t2].[Selected], [t2].[CreateDate]
FROM [dbo].[A] AS [t1]
WHERE (NOT ([t1].[Selected] = 1))
)
AS [t2]
As you can see the OrderBy dissapear in the sql sintax generated by linq, if someone could help with this would be great.