Singleton vs Scoped vs Transient Service Scope in C#
Followings are the specific use-case for different services.
- Caching Services
- Global Configuration
- Business Rules
- Persisting state that's useful for the runtime of an application
- Persisting state throughout application per request - New Instance is created for every request.
- Database Access
- File Access
- Services that should dispose of their state
- When you need a fresh instance of an object every single time