public CharacterInterface(HumanType humanType, DroidType droidType) { Name = "Character"; Field <NonNullGraphType <StringGraphType> >("id", "The id of the character."); Field <StringGraphType>("name", "The name of the character."); Field <ListGraphType <CharacterInterface> >("friends"); Field <ListGraphType <EpisodeEnum> >("appearsIn", "Which movie they appear in."); ResolveType = obj => { if (obj is Human) { return(humanType); } return(droidType); }; }
public CharacterInterface(HumanType humanType, DroidType droidType) { Name = "Character"; Field<NonNullGraphType<StringGraphType>>("id", "The id of the character."); Field<StringGraphType>("name", "The name of the character."); Field<ListGraphType<CharacterInterface>>("friends"); Field<ListGraphType<EpisodeEnum>>("appearsIn", "Which movie they appear in."); ResolveType = obj => { if (obj is Human) { return humanType; } return droidType; }; }