Hi engincan, The names are different. I did not want to put the exact name out in the public domain. Are you free for a remote session? or please share your mail id. Thanks :)
Hi,
I have sent you an invite :)
the id param is there for employee entity. i am using the manager class in between and i have put all the properties inside the constructor for employee entity. if you could share your github id, i can share the repo with you.
Hi @EngincanV,
I added the following lines to the Contact domain class:
protected Contact() { } internal Contact (Guid id) : base(id) { }
The error still shows. Is there something I am missing?
Thank you :)
Maliming,
Meanwhile could you please remove the screenshot of the debugging screen?
Thank you
hi maliming,
the getasync works but it doesnt show the other 2 collections, but when using getextendedasync it shows all 3 collections except the 2 subcollections.
Which shall we use?
The queryable extension was for withdetailsasync right? Is it enough to add the relationships for those 2 collections in the queryableextension?
Thank you :)
Hi,
I have updated the code with the changes in the repo that I shared with you earlier. Please let me know.
Thank you
Hi, I did the following:
created EfCoreEntityTypeQueryableExtension
with the following code:
public static IQueryable<EntityType> IncludeDetails(this IQueryable<EntityType> queryable, bool include = true)
{
if (!include)
{
return queryable;
}
return queryable.Include(et => et.Contacts)
.ThenInclude(ec => ec.PhoneNumbers)
.Include(et => et.Contacts)
.ThenInclude(ec => ec.FaxNumbers);
}
Then wrote the following in EfCoreEntityTypeRepository
:
public override async Task<IQueryable<EntityType>> WithDetailsAsync()
{
return (await GetQueryableAsync()).IncludeDetails();
}
This still doesn't populate the data retrieved. Is there anywhere else I have to check?
Thank you :)
Hi maliming,
Should I use WithDetailsAsync as well along with it or this is separate?
TY
Hi maliming,
Thank you for the reply. I was able to obtain 1 level of relationship using the following code:
public async Task<EntityTypeDto> GetExtendedAsync(Guid id)
{
//eager loading
var queryable = await _entityTypeRepository.WithDetailsAsync(x => x.Contacts,
x => x.Addresses,
x => x.Roles);
var query = queryable.Where(x => x.Id == id);
var entityType = await AsyncExecuter.FirstOrDefaultAsync(query);
return ObjectMapper.Map<EntityType, EntityTypeDto>(entityType);
}
How to drill down into another level of relationships within Contacts to obtain collection of PhoneNumbers like below:
var entityName = context.EntityNames
.Include(entityName => entityName.Contacts)
.ThenInclude(contact => contact.PhoneNumbers)
.ToList();