I want to convert sql query to entity framework core. SQL query is
select * from Departments where id in(select DepartmentId from SubDepartments where id in(select SubDeptId from Tests where id in(select TestId from PatientTests where PatientId=3)))
Assuming navigation properties are implemented, and without having any example code, this is a best estimate of how to implement it.
context.Departments.Where(x => x.SubDepartment.Test.PatientTest.PatientId == 3);