public EasyStoreQuery(IImperialStarDestroyerRepository ImperialStarDestroyerRepository, ITieFighterRepository TieFighterRepository) { Field <ImperialStarDestroyerType>( "spaceship", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "id", Description = "ImperialStarDestroyer id" } ), resolve: context => ImperialStarDestroyerRepository.GetImperialStarDestroyerAsync(context.GetArgument <int>("id")).Result ); Field <ListGraphType <ImperialStarDestroyerType> >( "spaceships", resolve: context => ImperialStarDestroyerRepository.GetImperialStarDestroyersAsync()); Field <TieFighterType>( "tiefighter", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IntGraphType> > { Name = "id", Description = "TieFighter id" } ), resolve: context => TieFighterRepository.GetTieFighterAsync(context.GetArgument <int>("id")).Result ); }
public TieFighterType(IImperialStarDestroyerRepository ImperialStarDestroyerRepository) { Field(x => x.Id).Description("TieFighter id."); Field(x => x.Name).Description("TieFighter name."); Field(x => x.Description, nullable: true).Description("TieFighter description."); Field(x => x.Price).Description("TieFighter price."); Field <ImperialStarDestroyerType>( "ImperialStarDestroyer", resolve: context => ImperialStarDestroyerRepository.GetImperialStarDestroyerAsync(context.Source.ImperialStarDestroyerId).Result ); }