你好,我必须过滤许多表。例如;
public class LanguageSchool
{
public long Id { get; set; }
public virtual List<LanguageSchoolLanguageSchoolProgram> LanguageSchoolLanguageSchoolPrograms { get; set; }
}
public class LanguageSchoolProgram
{
public long Id { get; set; }
public virtual List<LanguageSchoolLanguageSchoolProgram> LanguageSchoolLanguageSchoolPrograms { get; set; }
}
public class LanguageSchoolLanguageSchoolProgram
{
public long LanguageSchoolProgramId { get; set; }
public virtual LanguageSchoolProgram LanguageSchoolProgram { get; set; }
public long LanguageSchoolId { get; set; }
public virtual LanguageSchool LanguageSchool { get; set; }
}
并查询;
List<long> selectedLanguageEducationIds = [1,2,4,6]
foreach (var education in langEducations)
{
var list = context.LanguageSchools
.Where(x => x.LanguageSchoolLanguageEducations
.Contains(new LanguageSchoolLanguageEducation() {
LanguageEducation = education,
LanguageSchool = x,
LanguageEducationId = education.Id,
LanguageSchoolId = x.Id
})
).ToList();
}
,但是此代码不起作用。我的问题是我如何搜索/过滤/查询许多属性。