How does one go about scoping for example a DB session, if you both have the logic called by requests, and some scheduled job which also calls into it? Its two different entries, but is it possible to solve this with scopes?
Context: We are using CQRS and our command/query/event handlers are oblivious to how they are called as we are using a mediator, and they should have repository and db session injected. A http request might trigger a handler, but a scheduled service may also do that, but how do we choose the "right" db session for injection if the handler is completely unaware of who calls it? :)