我需要制作将运行 SQL 查询的 LINQ 查询
Select * from Employee where Employee.StartDate is null OR
(Employee.StartDate is not null AND Employee.StartDate > GetDate())
我试过以下代码
Employee.Where(e => e.StartDate == null ||
(e.StartDate != null && e.StartDate > Datetime.Today);
Employee.Where(e => e.StartDate.HasValue == false ||
(e.StartDate.HasValue != false && e.StartDate > Datetime.Today);
Employee.Where(e => e.StartDate..Equals((DateTime?)null) ||
(e.StartDate.HasValue != false && e.StartDate > Datetime.Today);
但它没有生成正确的 SQL 来检查两者。
料青山看我应如是
泛舟湖上清波郎朗
肥皂起泡泡
相关分类