- Home
- .NET coding challenges
- ASP.NET Core dependency injection service lifetimes
ASP.NET Core dependency injection service lifetimes
When using dependency injection, there are three service lifetimes that can be used:
- Singleton
- Scoped
- Transient
Your job is to match each service lifetime with one of the definitions below:
- The lifetime is initalised when a HTTP request has been made and is disposed of when the HTTP response has been sent. It can also be defined explicitly.
- The lifetime is initalised every time a service is injected.
- The lifetime will last for the lifetime of the application.
To help you, watch our video on dependency injection in ASP.NET Core.
Give us your anonymous feedback regarding this page, or any other areas of the website.