UserType:
[Node(IdField = nameof(Id))]
public class UserType
{
public Guid Id { get; set; }
public string Email { get; set; } = string.Empty;
public Company? Company { get; set; }
[NodeResolver]
public static async Task<UserType> GetUser(
Guid id,
UserByIdDataLoader userById,
CancellationToken cancellationToken,
[Service] IMapper mapper)
=> mapper.Map<Data.User, UserType>(await userById.LoadAsync(id,cancellationToken));
}
Query:
[UseApplicationDbContext]
[UsePaging]
[UseProjection]
[UseFiltering]
public IQueryable<UserType> GetUsers(
[ScopedService] ApplicationDbContext dbContext,
[Service] IMapper mapper)
{
return mapper.ProjectTo<UserType>(
dbContext.Users.AsNoTracking());
}
if I run this query:
users(first:4){
edges{
node{
id
company{
companyName
}
}
}
}
it will run db query like this
SELECT `t`.`Id`, `c`.`Id` IS NOT NULL, `c`.`CompanyName`
FROM (
SELECT `a`.`Id`
FROM `AspNetUsers` AS `a`
LIMIT @__p_0
) AS `t`
LEFT JOIN `Companies` AS `c` ON `t`.`Id` = `c`.`UserId`
if I use dataloader for get company. it will get all of property of Company(*can not use projection to dataloader).
so, if I use projection is there any performance problem even if I don't use dataloader?