Closed longvietcode closed 6 months ago
Don't inject your mediator, you should resolve from the service scope just like your DbContext. And it looks like it's not MediatR that's the problem, it's the dependencies of that handler that can't be resolved. The exception description tells you exactly what dependency can't be resolved.
.NET version: 8.0 MediatR version: 12.2.0
So I went into this error while trying to register MedaitR with the DI in my WorkerService project![image](https://github.com/jbogard/MediatR/assets/32150437/2ff86ad9-65e9-4da8-ab8f-3b19d893223a)
This is the Program file in my WorkerService project and my Solution hierarchy:
![image](https://github.com/jbogard/MediatR/assets/32150437/6a5110bc-4313-4059-839e-001072dd8c63)
The location of the CQS implementation that I need to use:![image](https://github.com/jbogard/MediatR/assets/32150437/2966baf4-8d6d-454c-94cb-c6debc4e7b5e)
The location that I need to use it:![image](https://github.com/jbogard/MediatR/assets/32150437/bf345173-d862-4eb7-961b-c2f85218f3d5)
This is how I inject it:![image](https://github.com/jbogard/MediatR/assets/32150437/973ed11f-7d10-4824-8487-8cb8af245fa8)
How can I resolve this error, thanks!