考虑以下 SQL 查询:
SELECT
*
FROM
Orders
WHERE
(AdjShipDate IS NOT NULL OR EstShipDate IS NOT NULL)
AND
CASE
WHEN AdjShipDate IS NOT NULL THEN AdjShipDate
WHEN AdjShipDate IS NULL AND EstShipDate IS NOT NULL THEN EstShipDate
END
BETWEEN '2011-07-01' AND '2011-07-30'
案例的 WHEN 表达式取决于我要查询的表中的值 (AdjShipDate)。我将如何在 Linq to SQL 中编写类似的查询?