var v1 = _questionRepository.GetQuery().Where(q =>
q.EvaluationGroupId == evaluationGroupId &&
((q.TopicValue == questionTopic &&
q.Index > currentQuestionIndex) ||
(q.TopicValue > (questionTopic) &&
q.Index >= 0 && q.Id != currentQuestionIndex)))
.OrderBy(q => q.Index).OrderBy(a => a.TopicValue).FirstOrDefault();
var v2 = _questionRepository.GetQuery().Where(q =>
q.EvaluationGroupId == evaluationGroupId &&
((q.TopicValue == questionTopic &&
q.Index > currentQuestionIndex) ||
(q.TopicValue > (questionTopic) &&
q.Index >= 0 && q.Id != currentQuestionIndex)))
.OrderBy(q => q.Index).OrderBy(a => a.TopicValue).ToList().FirstOrDefault()
v1 != v2 ENTITIES DIFFERENT How is it possible? (Data in db the same)
repository operate with EF entities
problem was that it used OrderBy().OrderBy instead OrderBy().ThenBy(). So problem is there. if change source code to OrderBy().ThenBy() then all work correct.