【发布时间】:2011-09-10 15:39:12
【问题描述】:
List<ServicePacksDTO> allServicePacks = new List<ServicePacksDTO>();
using (var db = new DataContext())
{
allServicePacks=(
from sp in db.ServicePacks
join st in db.States.DefaultIfEmpty() on sp.State_id equals st.State_Id
join type in db.ServiceTypes on sp.ServiceType_Id equals type.ServiceType_Id
where
(type.ServiceType_desc.ToLower() == "accepted")
orderby sp.AustState_id
select sp.ToServicePacksDTO(db)).ToList();
}
当前代码工作正常,直到我尝试对状态进行外部连接。有没有容易做到这一点?
【问题讨论】:
标签: c# linq-to-sql outer-join