In linq is there 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)
Notice that first query uses include after where and second before where, but result is the same. Also how to see actual sql query? In this particular case perfomance is my main goal, can i improve the query? i need to change two properties : UserQuizes property, and UserQuizes-> VerbalQuizes-> Question property.
Would it be better to split up it two queries or use it like as it is
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…