Beispiel #1
0
        public HumanType(StarWarsService service)
        {
            Name = "Human";

            Interface <CharacterType>();

            Description = "A mechanical creature in the Star Wars universe.";

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

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

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

            Field <ListGraphType <EpisodeType> >("appearsIn", "Which movie they appear in.");

            Field(h => h.HomePlanet, nullable: true).Description("The home planet of the human.");
        }
        public DroidType(StarWarsService service)
        {
            Name = "Droid";

            Interface <CharacterType>();

            Description = "A human character in the Star Wars universe.";

            Field(d => d.Id).Description("The id of the droid.");

            Field(d => d.Name, nullable: true).Description("The name of the droid.");

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

            Field <ListGraphType <EpisodeType> >("appearsIn", "Which movie they appear in.");

            Field(d => d.PrimaryFunction, nullable: true).Description("The primary function of the droid.");
        }