我玩过Entity Framework和MySQL驱动程序。如果这是一个愚蠢的问题,请原谅。表格广告的空缺PK为FK。两个字段都标记为NOT NULL。我正在进行简单的加入:
var qry = (from vacancy in context.vacancies
join advert in context.adverts on vacancy.id equals advert.vacancies.id
where advert.status == 1
select
new
{
Id = advert.id
})
;
这将生成以下SQL:
SELECT 1 AS C1, Extent2.id FROM vacancies AS Extent1
INNER JOIN adverts AS Extent2 ON (Extent1.id = Extent2.vacancy_id) OR ((Extent1.id IS NULL) AND (Extent2.vacancy_id IS NULL))
WHERE 1 = Extent2.status
当列未标记为可空时,为什么EF为连接生成“IS NULL”条件?
谢谢,
鲍勃
答案 0 :(得分:0)