0
khalid created
I have one- to-many relationship between the following two classes WorkRoleTenantAssignment and Tenant.
I trying to get all WorkRoleTenantAssignment with Tenant Because tenant is an aggregate root and adding navigation property to aggregate roots is not allowed in Abp, I added new class below, similar to the classes generated by Abp suite
And I wrote the following Linq query to fetch data Work Roles Assignments along with their assigned tenants. When I run the code I got this following error: I have tried many ways to overcome this issue but with no luck. Your guidance is appreciated.
1 Answer(s)
-
0
Hi, try:
var tenants = await _tenantRepository.GetListAsync(); var result = await _workRoleTenantAssignments.Where(x => tenants.Select(t => t.Id).Contains(x.TenantId.Value)).ToListAsync(); tenants = tenants.TakeWhile(t => result.Select(r => r.TenantId).Contains(t.Id)).ToList();