首页 > 解决方案 > 如何在 LINQ - SQL 中选择 Null

问题描述

我有使用T-SQL query,我正在尝试将其重写为Linq.

这是 T-SQL 查询

Select NULL 
From Users U
inner join Porducts P on U.ProductId=P.ProductId
Where U.CreatedDate >= '2021-01-01'

这是我的 LINQ 查询

var queryResult= from u in _context.Users
                 join p in _context.Products on u.ProductId equals p.ProductId
                 where u.CreatedDate >= new DateTime(2021,01,01)
                 select (???);

我不知道如何select null在 LINQ 的select部分中编写。

标签: c#sqllinqsql-to-linq-conversion

解决方案


推荐阅读