In linq, there is a difference between:
EFDbContext _db = new EFDbContext(); 1)_db.UserQuizes .Where(uq => uq.UserId == currentUserId && uq.QuizId == quizId) .Include(qz => qz.Quiz.VerbalQuizes.Select(q => q.Question)).First() 2)_db.UserQuizes .Include(qz => qz.Quiz.VerbalQuizes.Select(q => q.Question)) .Where(uq => uq.UserId == currentUserId && uq.QuizId == quizId).First() 3)_db.UserQuizes .Include(qz => qz.Quiz.VerbalQuizes.Select(q => q.Question)) First(uq => uq.UserId == currentUserId && uq.QuizId == quizId)
Note that using the first query includes after where and where before, but the result is the same. Also how to see the actual sql query? In this particular case, the performance is my main goal, can I improve the query? I need to change two properties: the UserQuizes property and the UserQuizes-> VerbalQuizes-> Question property.
It would be better to split it into two queries or use it as it is
source share