Hi, Otis
I run into another issue today with ?? operator in C#. I want to order by the result of coalescing 2 columns. The query that I have is similar to this:
LinqMetaData mdata = new LinqMetaData(adapter);
var results = from o in mdata.Employee
orderby o.BirthDate ?? o.HireDate
select o;
This query works on NorthWind but may not be practically meaningful, only to demonstrate this problem.
The SQL query it generated is:
SELECT [LPLA_1].[EmployeeID] AS [EmployeeId], [LPLA_1].[LastName], [LPLA_1].[FirstName], [LPLA_1].[Title], [LPLA_1].[TitleOfCourtesy], [LPLA_1].[BirthDate], [LPLA_1].[HireDate], [LPLA_1].[Address], [LPLA_1].[City], [LPLA_1].[Region], [LPLA_1].[PostalCode], [LPLA_1].[Country], [LPLA_1].[HomePhone], [LPLA_1].[Extension], [LPLA_1].[Photo], [LPLA_1].[Notes], [LPLA_1].[ReportsTo], [LPLA_1].[PhotoPath] FROM [Northwind].[dbo].[Employees] [LPLA_1] ORDER BY [LPFA_1] ASC
It seems the ORDER BY failed to be generated. It's empty.
I also tried this using LinqToSql. It works as expected. I am wondering do I have to create a function mapping or what not.
Thanks in advance!