同学们,看下面的代码段就明白了:
一对多:
public ICollection<ReportLookup> GetReportLookup(IEnumerable<Guid> specialityID)
{
var list = _Repo.All(p => specialityID.Contains(p.Speciality.Id)).ToList();
return list;
}
多对一:
public ICollection<ReportLookup> GetReportLookup(Guid specialityID)
{
var list = _Repo.All(p => p.Specialitys.Contains(specialityID)).ToList();
return list;
}
多对多:
public ICollection<ReportLookup> GetReportLookup(IEnumerable<Guid> specialityID)
{
var list = _Repo.All(p => p.Specialitys.Any(x => specialityID.Contains(x.Id))).ToList();
return list;
}