-
Hello, We have an application where we use multiple schemas on different paths. I can take down the example to two different schemas. Example "ApplicationIntegrations"
This is how we test now:
Example "DMT"
This is how we test now:
When adding the middleware it doesn't matter if using the path /dmt or /applicationintegrations, both of them will load the schema from the first schema. In this case ApplicationIntegrationsSchema. If I go back to the old way it works like a charm and both of the paths have their respective schemas. But then the middleware is not applied. If there's any input that could help me in a better direction I'd be really happy. Been banging my head on the table for a couple of days over this. Thanks for a great package overall. I'll add the files with all content if that helps. program.cs
AddGraphQLBaseServices
AddApplicationIntegrationsGraphQLServices
AddDmtGraphQLServices
AddDmtGraphQLAppSettings
AddApplicationIntegrationsGraphQLAppSettings
DatalayerMiddleWare
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
What version of each GraphQL.NET package are you using? 7.x for all? |
Beta Was this translation helpful? Give feedback.
-
Change public class DatalayerMiddleWare<TSchema> : GraphQLHttpMiddleware where TSchema : ISchema
{
private readonly IUserHandler _userHandler;
private readonly ILogger<EndpointMetrics> _logger;
public DatalayerMiddleWare(RequestDelegate next, IGraphQLTextSerializer serializer, IDocumentExecuter<TSchema> documentExecuter, IServiceScopeFactory serviceScopeFactory, GraphQLHttpMiddlewareOptions options, IHostApplicationLifetime hostApplicationLifetime, IUserHandler userHandler, ILogger<EndpointMetrics> logger) : base(next, serializer, documentExecuter, serviceScopeFactory, options, hostApplicationLifetime)
{
_userHandler = userHandler;
_logger = logger;
}
protected override async ValueTask<bool> HandleAuthorizeAsync(HttpContext context, RequestDelegate next)
{
//Internal logic for some Authorization
return await base.HandleAuthorizeAsync(context, next);
}
} |
Beta Was this translation helpful? Give feedback.
-
I believe you could also change the base class to |
Beta Was this translation helpful? Give feedback.
-
The middleware by default does not set the But rather anticipates that the This behavior described above then occurs here: In your case you are using It pulls the |
Beta Was this translation helpful? Give feedback.
Change
IDocumentExecuter
toIDocumentExecuter<TSchema>
here: