Я сейчас загружаю свои данные, используя EF Core 2.1, и в моих включаемых данных есть коллекция.
Я пробовал AsEnumerable
и ToAsyncEmumerable
, но это не работает. точка останова показывает на balanceQuestion
значение count = 0
public class OutcomeMeasurementTools
{
[Key] public int OutcomeMeasurementToolsId { get; set; }
public bool IsWound { get; set; }
public bool IsPediatrics { get; set; }
public bool IsPelvic { get; set; }
public bool IsVestibular { get; set; }
public bool IsUpperExtremity { get; set; }
public bool IsSpine { get; set; }
public bool IsLowerExtremity { get; set; }
public bool IsBalance { get; set; }
public bool IsPain { get; set; }
public bool IsGeneralFunction { get; set; }
public ProgressNoteObjective ProgressNoteObjective { get; set; }
public int ProgressNoteObjectiveId { get; set; }
public Balance Balance { get; set; }
}
public class Balance
{
[Key] public int BalanceId { get; set; }
public double? Score { get; set; }
public bool IsABCScale { get; set; }
public bool IsBerg { get; set; }
public bool IsFAB { get; set; } // Fullerton Advanced Balance (FAB) Scale
public bool IsMSS { get; set; } // Motion Sensitivity Score *
public bool IsTinetti { get; set; }
public bool IsMCTSIB { get; set; } // *
public ICollection<BalanceQuestions> BalanceQuestions { get; set; } // this return count 0 but i have my data in db
public MSS MSS { get; set; }
public MCTSIB MCTSIB { get; set; }
public OutcomeMeasurementTools OutcomeMeasurementTools { get; set; }
public int OutcomeMeasurementToolsId { get; set; }
}
public class BalanceQuestions
{
[Key] public int BalanceQuestionId { get; set; }
public int? Score { get; set; }
// Identifier
public bool IsABCScale { get; set; }
public bool IsBerg { get; set; }
public bool IsFAB { get; set; } // Fullerton Advanced Balance (FAB) Scale
public bool IsTinetti { get; set; }
public int? Q1 { get; set; }
public int? Q2 { get; set; }
public int? Q3 { get; set; }
public int? Q4 { get; set; }
public int? Q5 { get; set; }
public int? Q6 { get; set; }
public int? Q7 { get; set; }
public int? Q8 { get; set; }
public int? Q9 { get; set; }
public int? Q10 { get; set; }
public int? Q11 { get; set; }
public int? Q12 { get; set; }
public int? Q13 { get; set; }
public int? Q14 { get; set; }
public int? Q15 { get; set; }
public Balance Balance { get; set; }
public int BalanceId { get; set; }
}
public async Task<OutcomeMeasurementTools> GetOutcomeMeasurementTools(int progressNoteObjectiveId)
{
return await progressNoteRepo.GetOutcomeMeasurementTools(progressNoteObjectiveId)
.Include(x => x.Balance)
.ThenInclude(x => x.BalanceQuestions)
.Include(x => x.Balance)
.ThenInclude(x => x.MCTSIB)
.ThenInclude(x => x.C1)
.Include(x => x.Balance)
.ThenInclude(x => x.MCTSIB)
.ThenInclude(x => x.C2)
.Include(x => x.Balance)
.ThenInclude(x => x.MCTSIB)
.ThenInclude(x => x.C3)
.Include(x => x.Balance)
.ThenInclude(x => x.MCTSIB)
.ThenInclude(x => x.C4)
.Include(x => x.Balance)
.ThenInclude(x => x.MSS).SingleOrDefaultAsync();
}