I have three tables, each of which is associated with a primary key and a foreign key, such as TestId and UserTestId, etc.
Exam > Test > UserTest
That is my understanding. I can use LINQ to get data from them as follows:
var exams = _examsRepository
.GetAll()
.Where(q => q.SubjectId == subjectId)
.Include(q => q.Tests.Select(t => t.UserTests))
.ToList();
This will select all exams, exam tests, and user tests for those tests in which SubjectId == subjectID
Is there any possible way that I could limit this so that it only shows data when user tests had a UserId of 123?
If the answer is no, should I rewrite this LINQ to go to _userTestsRepository first and then work in the other direction up and not down?