我编写了查询,我想将其转换为linq查询
SELECT dbo.tblSaman.fldSamanId, dbo.tblFaaliatSaman.FldFaaliatId
FROM dbo.tblSaman LEFT OUTER JOIN
dbo.tblFaaliatSaman ON dbo.tblSaman.fldSamanId = dbo.tblFaaliatSaman.fldSamanId
WHERE (dbo.tblFaaliatSaman.FldFaaliatId IN (3, 4))
答案 0 :(得分:0)
尝试使用类似的东西:
int[] ids = { 3, 4 };
var items = context.tblSaman.Join(context.tblFaaliatSaman.DefaultIfEmpty().Where(x => ids.Contains(x.FldFaaliatId)), x => x.fldSamanId,
y => y.fldSamanId, (x, y) => new { fldSamanId = x.fldSamanId, FldFaaliatId = y.FldFaaliatId });