Qualcuno vede cosa sto sbagliando?
ProjectActivityTasks
ha UnitOfMeasureId
e ProjectActivityTaskTypeId
. Con il modo in cui è scritto, pensa che UnitOfMeasure
vada a ProjectActivityTaskType
. Si sta verificando un ThenInclude
su ThenInclude
per UnitOfMeasure
dice
ProjectActivityTaskType non contiene una definizione per UnitOfMeasure
che è corretto. UnitOfMeasure
va a ProjectActivityTasks
.
Stavo facendo riferimento a questa pagina ma non sembra funzionare in questo modo: https://docs.microsoft.com/en-us/ef/core/querying/related-data
var qry = await _projectActivityRepository.GetAll()
.Include(x => x.ProjectActivityVehicles)
.ThenInclude(x => x.Vehicle)
.Include(x => x.ProjectActivityTasks)
.ThenInclude(x => x.ProjectActivityTaskType)
.ThenInclude(x => x.UnitOfMeasure)
.Where(x => x.Id == Id && x.TenantId == (int)AbpSession.TenantId)
.FirstOrDefaultAsync();
Puoi (e dovresti) ripetere la parte Include(x => x.ProjectActivityTasks)
:
var qry = await _projectActivityRepository.GetAll()
.Include(x => x.ProjectActivityVehicles)
.ThenInclude(x => x.Vehicle)
.Include(x => x.ProjectActivityTasks)
.ThenInclude(x => x.ProjectActivityTaskType)
.Include(x => x.ProjectActivityTasks)
.ThenInclude(x => x.UnitOfMeasure)
.Where(x => x.Id == Id && x.TenantId == (int)AbpSession.TenantId)
.FirstOrDefaultAsync();