【发布时间】:2011-04-12 18:41:49
【问题描述】:
以下按预期工作(LINQ to Entities):
var topics = (from t in ctx.Topics where t.SubjectId == subjectId && t.ParentId == null select new { t.Title, t.Id }).ToList();
但是,以下内容不返回任何内容:
int? parent = null;
var topics = (from t in ctx.Topics where t.SubjectId == subjectId && t.ParentId == parent select new { t.Title, t.Id }).ToList();
Topic.ParentId 是一个可为空的 int。这很容易解决,但这让我感到困惑。任何人都可以解释一下吗?
【问题讨论】:
标签: c# linq entity-framework linq-to-entities