public HumanType(StarWarsData data)
        {
            Name = "Human";

            Field(h => h.Id).Description("The id of the human.");
            Field(h => h.Name, true).Description("The name of the human.");

            Field <ListGraphType <CharacterInterface> >(
                "friends",
                resolve: context => data.GetFriends(context.Source)
                );

            Interface <CharacterInterface>();
        }
Exemplo n.º 2
0
        public StarWarsQuery(StarWarsData data)
        {
            Name = "Query";

            Field <ListGraphType <HumanType> >(
                "humans",
                resolve: context => data.GetHumansAsync()
                );

            Field <HumanType>(
                "human",
                arguments: new QueryArguments(
                    new QueryArgument <StringGraphType> {
                Name = "id", Description = "id of the human"
            }
                    ),
                resolve: context => data.GetHumanByIdAsync(context.GetArgument <string>("id"))
                );
        }