A service lifetime defines how a service instance is maintained or created by the ASP.NET Core Inversion of Control (IoC) container when a calling method or constructor requests for a new service instance. There are three types of services based on how their instance lifetime is managed:
- Singleton: New instance is created only once during its entire lifetime, across requests
- Transient: New Instance created each time a component requests for an object
- Scoped: New instance is created only once per request and is reused for all calls within a request
You can learn about these types in detail here – What are Service Lifetimes in ASP.NET Core Dependency Injection Explained in Detail