我知道 Linq 的左连接是这样的:
var q=from e in db.Employes
join o in db.Orders on e equals o.Emoloyee into ords
from on in ords.DefautIfEmpty()
select new
{
e.FirstName,
e.LastName
};
那么多重连接呢?这是我的代码
var personalInfoQuery = from t in crnnsupContext.Tombstones
join p in crnnsupContext.ProvStates on t.ProvinceState equals p.ProvinceStateID
join n in crnnsupContext.NursingSchools on t.NursingSchool equals n.SchoolID
join i in crnnsupContext.InitialEducations on t.InitialEducation equals SqlFunctions.StringConvert((double)i.InitalEducationID, 1)
join g in crnnsupContext.tbl_GraduatedProvCountry on t.GradPovCountry equals g.id
where t.RegNumber == _username
select new CPersonalInfo
{
ProvState = p,
Tombstone = t,
NursingSchool = n,
InitialEducation = i,
GraduatedProvCountry = g,
};
每个连接表都可以有“空”字段。有什么可以帮助我的,谢谢