Dependency Injection Service Lifetimes (In .NET Core and .NET 5.0)

The Dependency Injection (DI) design pattern [which is one of the implementations of the Inversion Of Control (IoC)], is supported out of the box by the .NET Core and .NET 5.0. In this video, I am going to walk through the three different service lifetimes provided by the Dependency Injection framework provided by .NET Core or .NET 5.0 out of the box. 1. Transient: Every request creates a new instance. 2. Scoped: Once per request. 3. Singleton: Created only once. 00:36 : Walkthrough of the definition of the three types of service lifetimes 03:22 : Creating a new project 03:38 : Create a new CountController controller class 03:52 : Create a new Counter class 05:12 : Create a new FirstCounter class 07:02 : Create a new SecondCounter class 07:36 : Update CountController 08:30 : Update Startup class with configuring all classes with transient 10:50 : Update Counter in Startup class to change from Transient to Scoped 13:10 : Update Counter in Startup class to change from Transient to Singleton At 03:02 : My slide says Scoped, which should have been Singleton. My website: https://dotnetcorecentral.com/ My GitHub repo: https://github.com/choudhurynirjhar