예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
        }