public Query(IEfGraphQLService efGraphQlService) : base(efGraphQlService) { AddQueryField <CustomTypeGraph, CustomTypeEntity>( name: "customType", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.CustomTypeEntities); }); AddQueryField <SkipLevelGraph, Level1Entity>( name: "skipLevel", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.Level1Entities); }); AddQueryField <WithManyChildrenGraph, WithManyChildrenEntity>( name: "manyChildren", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.WithManyChildrenEntities); }); AddQueryField <Level1Graph, Level1Entity>( name: "level1Entities", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.Level1Entities); }); efGraphQlService.AddQueryField <WithNullableGraph, WithNullableEntity>(this, name: "withNullableEntities", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.WithNullableEntities); }); efGraphQlService.AddQueryField <WithMisNamedQueryParentGraph, WithMisNamedQueryParentEntity>(this, name: "misNamed", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.WithMisNamedQueryParentEntities); }); efGraphQlService.AddQueryField <ParentGraph, ParentEntity>(this, name: "parentEntities", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.ParentEntities); }); efGraphQlService.AddQueryField <ChildGraph, ChildEntity>(this, name: "childEntities", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.ChildEntities); }); efGraphQlService.AddQueryConnectionField <ParentGraph, ParentEntity>(this, name: "parentEntitiesConnection", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.ParentEntities); }); efGraphQlService.AddQueryConnectionField <ChildGraph, ChildEntity>(this, name: "childEntitiesConnection", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.ChildEntities); }); efGraphQlService.AddQueryField <FilterParentGraph, FilterParentEntity>(this, name: "parentEntitiesFiltered", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.FilterParentEntities); }); efGraphQlService.AddQueryConnectionField <FilterParentGraph, FilterParentEntity>(this, name: "parentEntitiesConnectionFiltered", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.FilterParentEntities); }); }
public Query(IEfGraphQLService <IntegrationDbContext> efGraphQlService) : base(efGraphQlService) { AddQueryField( name: "customType", resolve: context => context.DbContext.CustomTypeEntities); AddQueryField( name: "skipLevel", resolve: context => context.DbContext.Level1Entities, graphType: typeof(SkipLevelGraph)); AddQueryField( name: "queryFieldWithInclude", resolve: context => { var dataContext = context.DbContext; return(dataContext.IncludeNonQueryableBs.AsQueryable() .Select(p => p.IncludeNonQueryableA)); }); AddQueryField( name: "manyChildren", resolve: context => context.DbContext.WithManyChildrenEntities); AddQueryField( name: "level1Entities", resolve: context => context.DbContext.Level1Entities); AddQueryField( name: "withNullableEntities", resolve: context => context.DbContext.WithNullableEntities); AddQueryField( name: "namedEntities", resolve: context => context.DbContext.NamedEntities); AddQueryField( name: "misNamed", resolve: context => context.DbContext.WithMisNamedQueryParentEntities); AddQueryField( name: "parentEntities", resolve: context => context.DbContext.ParentEntities); AddQueryField( name: "childEntities", resolve: context => context.DbContext.ChildEntities); efGraphQlService.AddQueryConnectionField <ParentGraph, ParentEntity>( this, name: "parentEntitiesConnection", resolve: context => context.DbContext.ParentEntities); efGraphQlService.AddQueryConnectionField <ChildGraph, ChildEntity>( this, name: "childEntitiesConnection", resolve: context => context.DbContext.ChildEntities); AddQueryField( name: "parentEntitiesFiltered", resolve: context => context.DbContext.FilterParentEntities); efGraphQlService.AddQueryConnectionField <FilterParentGraph, FilterParentEntity>( this, name: "parentEntitiesConnectionFiltered", resolve: context => context.DbContext.FilterParentEntities); AddSingleField( name: "parentEntity", resolve: context => context.DbContext.ParentEntities); AddSingleField( name: "parentEntityNullable", resolve: context => context.DbContext.ParentEntities, nullable: true); }