我有以下 LINQ 表达式:
public IList<Objective> GetObjectives(int examId)
{
var objectives = _objectivesRepository
.GetAll()
.Where(o => o.ExamId == examId || examId == 0)
.Include(o => o.ObjectiveDetails)
.ToList();
return objectives;
}
public partial class Objective
{
public int ObjectiveId { get; set; }
public int ExamId { get; set; }
public int Number { get; set; }
public virtual ICollection<ObjectiveDetail> ObjectiveDetails { get; set; }
}
public partial class ObjectiveDetail
{
public int ObjectiveDetailId { get; set; }
public int ObjectiveId { get; set; }
public int Number { get; set; }
public string Text { get; set; }
}
如何修改此表达式,以便按顺序返回目标,并按顺序Number
返回 ObjectiveDetails Number
?