UseAssemblySchema
Package Trax.Api.GraphQL.Client.TraxNamespace Trax.Api.GraphQL.Client.TraxSource TraxBuilderExtensions.cs, AssemblySchemaProvider.cs
Replaces the client's schema provider with AssemblySchemaProvider, which builds the server's
HotChocolate schema in-process from the server's own configuration delegate. Declared on the static
class TraxBuilderExtensions.
Signature
public static TraxGraphQLClientBuilder UseAssemblySchema(
this TraxGraphQLClientBuilder builder,
Action<IRequestExecutorBuilder> configureSchema)Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
builder | TraxGraphQLClientBuilder | Yes | The client's builder |
configureSchema | Action<IRequestExecutorBuilder> | Yes | Configures a HotChocolate request executor the way the server's Program.cs does |
Returns
The same TraxGraphQLClientBuilder.
Behavior
- Throws
ArgumentNullExceptionwhen either argument isnull. - On the first schema request the provider runs
configureSchemaagainst a freshservices.AddGraphQL(), builds the executor, prints its schema to SDL and builds the validator's schema from that. No network call is made. A failure throwsGraphQLSchemaIntrospectionExceptioncarrying the generated SDL. - The subscription type is dropped when the client's
RemoveSubscriptionsFromSchemaistrue, the default. - The calling process takes a binary dependency on the assembly that defines
configureSchema. - As with the other schema methods, the last one called on a builder decides the provider.
Example
services
.AddTraxGraphQLClient(new Uri("https://players.example.com/graphql"))
.UseAssemblySchema(PlayerSchema.Configure)
.UseStartupValidation(typeof(Program).Assembly);See also
- ISchemaProvider, which lists
AssemblySchemaProvider's constructors - TraxGraphQLClientBuilder
- UseStartupValidation