Our project is using multitenancy to resolve some Service, lets say MyService
based on SaasKit.
We also have a background task, which shares some of it's dependencies with the asp.net core controllers.
In the background task, any object that depends on MyService
will get a null reference.
I can implement workarounds to get instances of MyService
, like using service locator pattern, but this approach fails to create classes that depend on MyService
without breaking DI and IOC logic.
So the question is: How can I get the same services that I can get from HttpContext
with multitenancy, but get them without an HttpCoontext
?