'GraphQLErrorFilter Save Error log in Database

I'm trying to save to the database all the errors that the error filter get. This is what i'm trying.

in Startup.cs

.AddErrorFilter<GraphQLErrorFilter>(provider =>
           {
               
               return new GraphQLErrorFilter(provider.GetRequiredService<IUnitOfWork>());
           })

In the Error filter i'm calling the log service as a normal service.

private readonly IUnitOfWork unitOfWork;
    //private readonly ILogsService logs;
    public GraphQLErrorFilter(IUnitOfWork unitOfWork)
    {
        this.unitOfWork = unitOfWork;
        //this.logs = logs;
    }

Im getting this error message:

No service for type 'XXXXXXXXX.IUnitOfWork' has been registered.'



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source