coreex-graphql

Adds GraphQL-lite query endpoints to CoreEx .NET API hosts by bridging existing QueryArgsConfig and read services.

28|8|Updated Feb 21, 2022
One-click install
npx skills add https://github.com/Avanade/CoreEx --skill coreex-graphql-avanade
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: coreex-graphql
Source: https://github.com/Avanade/CoreEx/tree/main/.github/skills/coreex-graphql
Command: npx skills add https://github.com/Avanade/CoreEx --skill coreex-graphql-avanade

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Wiring a GraphQL query surface onto a CoreEx .NET API host involves several error-prone details: correct Program.cs registration order, singleton-versus-scoped dependency resolution, identifier argument validation, and keeping GraphQL roots in lockstep with existing REST query configuration. This Skill guides that wiring so the GraphQL endpoint reuses the entity's existing QueryArgsConfig and read services instead of duplicating query logic. ## Core Features & Use Cases - First-time enablement: Registers AddCoreExGraphQLLite in Program.cs, maps the /query endpoint after MapControllers, and adds OpenTelemetry tracing via WithCoreExGraphQLTelemetry. - Entity root registration: Adds AddQuery/AddGet roots per entity that bridge to existing QueryArgsConfig and QueryAsync/GetAsync methods, with GetIdentifier<TId> handling identifier argument validation. - Bulk reference data exposure: Exposes every reference data type known to ReferenceDataOrchestrator as GraphQL roots via AddReferenceDataQueries with a configurable prefix and exclusion list. - Use Case: After scaffolding a REST query endpoint for a Product entity, add a matching GraphQL root on the same host and record the enablement in the host's AGENTS.md so future sessions know GraphQL is active. ## Quick Start Add a GraphQL query endpoint to my Products.Api host exposing the Product entity and all reference data types.

Frequently Asked Questions about coreex-graphql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a GraphQL endpoint to a CoreEx .NET API?▼

Register builder.Services.AddCoreExGraphQLLite in Program.cs with AddQuery and AddGet roots per entity, then call app.MapCoreExGraphQLLite("/query") after app.MapControllers(). Each root bridges to the entity's existing QueryArgsConfig and read-service methods.

How do I expose reference data through GraphQL in CoreEx?▼

Call AddReferenceDataQueries(sp, ReferenceDataQueryArgsConfig.Default) inside the AddCoreExGraphQLLite registration. It bulk-registers every reference data type known to ReferenceDataOrchestrator as a query root, named with a configurable prefix such as ref_, with an excludeTypes option to opt types out.

Does CoreEx GraphQL-lite support mutations or subscriptions?▼

No. GraphQL-lite is read-only by design, supporting single-root-per-selection queries with forward pagination only (first/after). It is a REST-adjacent query surface for *.Api hosts and does not support mutations or subscriptions.

Why does my GraphQL resolver fail with scoped service errors in CoreEx?▼

IGraphQLEngine is a singleton, so capturing a scoped service from the root IServiceProvider at registration time fails. Resolve scoped dependencies per-invocation inside each resolver using CoreEx.ExecutionContext.GetRequiredService<T>() instead.

When should I not use CoreEx GraphQL-lite?▼

Do not use it for REST controller endpoints, for defining or changing a QueryArgsConfig itself, or on Subscribe/Relay hosts. GraphQL-lite only bridges to existing query configuration and never adds new filter or sort capability of its own.