It's important to understand the lifetime of the services when you are doing the DI, so you can choose what's best.
- services.AddTransient:<>
- Transient objects are always different. That's a new object is created every time it's requested.
- services.AddScoped<>
- Scoped objects are the same for a given request but differ across each new request.
- services.AddSingleton<>
- Singleton objects are the same for every request.
I believe this will help you determine what's best for your scenario.