我想用entiy框架编写以下代码。 有点困难。我在等你的帮助。
select* from LocaleStringResource as locale
cross join Language language
left join LocaleStringResourceLanguage localeLang
on locale.Id = localeLang.RecordId and
language.ID = localeLang.LanguageId
答案 0 :(得分:0)
我假设了一些信息,因为您没有给我们提供有关实体的足够信息。我想您正在尝试这样做。试试这个,让我们知道这是否是正确的方法。
var query = (from locale in _context.LocaleStringResource
from language in _context.Language
join localeLangBefLJ in _context.LocaleStringResourceLanguage on new { field1 = locale.Id, field2 = language.ID } equals new { field1 = localeLangBefLJ.RecordId, field2 = localeLangBefLJ.LanguageId }
into localeLang
from x in localeLang.DefaultIfEmpty()
select new
{
locale,
language,
x
})