I am just starting in GraphQL (with .NET, but I don't think that matters here). I have learned how to pass variables that are properties of the type I am querying, but I am not sure how to pass variables that are NOT properties.
For example, I have a database full of Drivers, who all belong to 1 or more Client. Driver object does NOT have a ClientId property. Instead, there is a Client object with 0 or more Driver objects.
Driver.cs:
public class Driver
{
public long Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
In RootQuery constructor:
Field<ListGraphType<DriverGraph>>(
name: "clientDrivers",
arguments: new QueryArguments(
new QueryArgument<IntGraphType> { Name = "clientId" }),
resolve: context => driverRepo.GetClientDrivers(context.GetArgument<long>("clientId"))
);
Is this possible? Or do I have to either a) add a ClientId property to my driver object, or b) implement a "ClientGraph" object?
Thanks!