Esempio n. 1
0
        public DroidType()
        {
            var data = new StarWarsData();

            Name = "Droid";
            Fields = new List<FieldType>
            {
                new FieldType
                {
                    Name = "id",
                    Description = "The id of the droid.",
                    Type = new NonNullGraphType(new StringGraphType())
                },
                new FieldType
                {
                    Name = "name",
                    Description = "The name of the droid.",
                    Type = new NonNullGraphType(new StringGraphType())
                },
                new FieldType
                {
                    Name = "friends",
                    Type = new ListGraphType(typeof(CharacterInterface)),
                    Resolve = (context) =>
                    {
                        return data.GetFriends(context.Source as StarWarsCharacter);
                    }
                }
            };
            Interfaces = new List<InterfaceGraphType>
            {
                new CharacterInterface()
            };
        }
Esempio n. 2
0
        public DroidType()
        {
            var data = new StarWarsData();

            Name   = "Droid";
            Fields = new List <FieldType>
            {
                new FieldType
                {
                    Name        = "id",
                    Description = "The id of the droid.",
                    Type        = new NonNullGraphType(new StringGraphType())
                },
                new FieldType
                {
                    Name        = "name",
                    Description = "The name of the droid.",
                    Type        = new NonNullGraphType(new StringGraphType())
                },
                new FieldType
                {
                    Name    = "friends",
                    Type    = new ListGraphType(typeof(CharacterInterface)),
                    Resolve = (context) =>
                    {
                        return(data.GetFriends(context.Source as StarWarsCharacter));
                    }
                }
            };
            Interfaces = new List <InterfaceGraphType>
            {
                new CharacterInterface()
            };
        }
Esempio n. 3
0
        public HumanType(StarWarsData data)
        {
            Name = "Human";

            Field <NonNullGraphType <StringGraphType> >("id", "The id of the human.");
            Field <StringGraphType>("name", "The name of the human.");
            Field <ListGraphType <CharacterInterface> >(
                "friends",
                resolve: context => data.GetFriends(context.Source as StarWarsCharacter)
                );
            Field <ListGraphType <EpisodeEnum> >("appearsIn", "Which movie they appear in.");
            Field <StringGraphType>("homePlanet", "The home planet of the human.");

            Interface <CharacterInterface>();
        }
Esempio n. 4
0
        public HumanType(StarWarsData data)
        {
            Name = "Human";

            Field<NonNullGraphType<StringGraphType>>("id", "The id of the human.");
            Field<StringGraphType>("name", "The name of the human.");
            Field<ListGraphType<CharacterInterface>>(
                "friends",
                resolve: context => data.GetFriends(context.Source as StarWarsCharacter)
            );
            Field<ListGraphType<EpisodeEnum>>("appearsIn", "Which movie they appear in.");
            Field<StringGraphType>("homePlanet", "The home planet of the human.");

            Interface<CharacterInterface>();
        }
Esempio n. 5
0
        public DroidType(StarWarsData data)
        {
            Name        = "Droid";
            Description = "A mechanical creature in the Star Wars universe.";

            Field <NonNullGraphType <StringGraphType> >("id", "The id of the droid.");
            Field <StringGraphType>("name", "The name of the droid.");
            Field <ListGraphType <CharacterInterface> >(
                "friends",
                resolve: context => data.GetFriends(context.Source as StarWarsCharacter)
                );
            Field <ListGraphType <EpisodeEnum> >("appearsIn", "Which movie they appear in.");
            Field <StringGraphType>("primaryFunction", "The primary function of the droid.");

            Interface <CharacterInterface>();
        }
Esempio n. 6
0
        public DroidType(StarWarsData data)
        {
            Name = "Droid";
            Description = "A mechanical creature in the Star Wars universe.";

            Field<NonNullGraphType<StringGraphType>>("id", "The id of the droid.");
            Field<StringGraphType>("name", "The name of the droid.");
            Field<ListGraphType<CharacterInterface>>(
                "friends",
                resolve: context => data.GetFriends(context.Source as StarWarsCharacter)
            );
            Field<ListGraphType<EpisodeEnum>>("appearsIn", "Which movie they appear in.");
            Field<StringGraphType>("primaryFunction", "The primary function of the droid.");

            Interface<CharacterInterface>();
        }
Esempio n. 7
0
        public HumanType()
        {
            var data = new StarWarsData();

            Name = "Human";

            Field("id", "The id of the human.", NonNullGraphType.String);
            Field("name", "The name of the human.", ScalarGraphType.String);
            Field<ListGraphType<CharacterInterface>>(
                "friends",
                resolve: context => data.GetFriends(context.Source as StarWarsCharacter)
            );
            Field("appearsIn", "Which movie they appear in.", new ListGraphType<EpisodeEnum>());
            Field("homePlanet", "The home planet of the human.", ScalarGraphType.String);

            Interface<CharacterInterface>();
        }