Closed raminmjj closed 2 years ago
Same as me at jbogard/MediatR#682
This is not an issue with MediatR or how MediatR is registered with the container. You're trying to use a scoped service (DbContext) outside of a scope. You need to create a scope, then resolve services from that scope. See this example.
Hi, jimmy. you're right, the problem was in the base dbcontext constructor. I changed it from:
to
Thank you.
Hi, I created an application based on the "Clean Architecture Solution Template". and add another database provider like this article. everything works fine when the provider is set to base dbcontext, but when I change provider to another, I got these errors:
the second dbcontext registration is like this:
Thank you.