linq to ef(至關於sql中in的用法)查詢語句

select * from DoctorInfo doctor
where doctor.HosDepartId in
(select Id from HospitalDepartment hd
where hd.DepartmentId=5)it


var a=from d in _entity.HospitalDepartment
where d.DepartmentId==5
select d;foreach

List<int> lst=new List<int>();
foreach(var b in a)
{
lst.add(b);
}List

var doc=from c in _entity.DoctorInfo
where lst.contains(c.HospitalId)
select c;select

相關文章
相關標籤/搜索