Reconfigure SimpleWebApp to use the GraphQL.Server project and GraphQL.SystemTextJson
Simplify SimpleWebApp's Startup.cs
Simplify SubscriptionExample's Startup.cs
Deprecate execution-related classes
DocumentExecuter
DefaultErrorTransformation / IErrorTransformation
GraphQLExecutor / IGraphQLExecutor
RequestHandler / IRequestHandler
Request and Response
Deprecate all execution-related methods within GraphQLEngine
Deprecate schema printer methods within GraphQLEngine
Deprecate serialization-related classes
RequestDeserializer / IRequestDeserializer
QueryInput
Add extensions for IGraphQLBuilder, tied to GraphQLEngine, with NRT annotations
Move IdentifierForTypeOrNull with other similarly-named extensions
Add NRT annotations for GraphQLEngine
Bump GraphQL dependencies to latest version
Once the deprecated code is removed, perhaps in a later version, it will greatly reduce the amount of overlapped code between this project and the base project. We will also be able to remove the dependency on GraphQL.NewtonsoftJson.
Although the new setup is a bit more dependent on DI, the server project is compatible with frameworks as far back as ASP.NET Core 2.1 on .NET Framework 4.6.1, through .NET 7, including the latest standards, two subscription protocols, and most recently Azure Functions. It includes has a wide array of configuration options to fit with user requirements.
In addition, going forward, the conventions project can still be used by constructing a schema via GraphQLEngine, and users can utilize GraphQL.NewtonsoftJson or GraphQL.SystemTextJson to deserialize requests and serialize responses, and DocumentExecuter to execute documents. So there really is no loss of functionality even without the server project.
Before
var requestHandler = RequestHandler
.New()
.WithServiceProvider(serviceProvider)
.WithQueryAndMutation<Query, Mutation>()
.Generate();
var request = Request.New(new QueryInput { QueryString = "{ __schema { types { name } } }" });
var result = await requestHandler.ProcessRequestAsync(request, null, serviceProvider);
var resultJson = result.GetBody();
After (without DI)
var schema = GraphQLEngine
.New()
.WithQueryAndMutation<Query, Mutation>()
.GetSchema();
var executer = new GraphQL.DocumentExecuter();
var serializer = new GraphQL.SystemTextJson.GraphQLSerializer();
var ret = await executer.ExecuteAsync(new()
{
Schema = schema,
Query = "{ __schema { types { name } } }",
RequestServices = serviceProvider,
});
var retJson = serializer.Serialize(ret);
Changes:
Startup.cs
Startup.cs
DocumentExecuter
DefaultErrorTransformation
/IErrorTransformation
GraphQLExecutor
/IGraphQLExecutor
RequestHandler
/IRequestHandler
Request
andResponse
GraphQLEngine
GraphQLEngine
RequestDeserializer
/IRequestDeserializer
QueryInput
IGraphQLBuilder
, tied toGraphQLEngine
, with NRT annotationsIdentifierForTypeOrNull
with other similarly-named extensionsGraphQLEngine
Once the deprecated code is removed, perhaps in a later version, it will greatly reduce the amount of overlapped code between this project and the base project. We will also be able to remove the dependency on GraphQL.NewtonsoftJson.
Although the new setup is a bit more dependent on DI, the server project is compatible with frameworks as far back as ASP.NET Core 2.1 on .NET Framework 4.6.1, through .NET 7, including the latest standards, two subscription protocols, and most recently Azure Functions. It includes has a wide array of configuration options to fit with user requirements.
In addition, going forward, the conventions project can still be used by constructing a schema via GraphQLEngine, and users can utilize GraphQL.NewtonsoftJson or GraphQL.SystemTextJson to deserialize requests and serialize responses, and
DocumentExecuter
to execute documents. So there really is no loss of functionality even without the server project.Before
After (without DI)