C#C
C#3y ago
julian

✅ Scoped, Singleton and HostedService

Any .NET Masters here? xD

Issue:
I'm trying to create a new Background Service for automatic selling/buying crypto (It's a school project, so no real trading/money involved).
I'm having issues with the activation of the repo/services etc.

I'm adding the Repo to my Service, which has EF Core (Repo).
It has Scoped on the Repository classes.

When I try to add the Service as a Singleton and my background service as a HostedService, I just get an error that It can not activate.

I'm using ASP.NET Core Web API

Any work arounds?

I've tried posting in the DotNetEvolution, but didn't get any response.
Was this page helpful?