private async Task IncludeDetails(IResolveFieldContext context, List <User> users, List <UserDto> userDtos) { if (context.HasSelectionField(UserType.ChildFields.GetFieldSelector(UserType.ChildFields.Roles))) { AddRolesOfUsers(users, userDtos); } if (context.HasSelectionField(UserType.ChildFields.GetFieldSelector(UserType.ChildFields.OrganizationUnits))) { await AddOrganizationUnitsOfUsers(users, userDtos); } }
private static IQueryable <User> IncludeQuery(IQueryable <User> query, IResolveFieldContext context) { if (context.HasSelectionField(UserType.ChildFields.GetFieldSelector(UserType.ChildFields.Roles))) { query = query.Include(x => x.Roles); } if (context.HasSelectionField(UserType.ChildFields.GetFieldSelector(UserType.ChildFields.OrganizationUnits))) { query = query.Include(x => x.OrganizationUnits); } return(query); }