Visit complete ASP.NET Core roadmap
ASP.NET Core Topic

Life Cycles

Life Cycles

In ASP.NET, dependency injection (DI) lifecycles determine the lifetime of objects that are resolved through the DI container. There are several predefined lifecycle options in the Microsoft.Extensions.DependencyInjection library, including:

  • Transient: A new instance of the object is created every time it is requested.
  • Scoped: A new instance of the object is created for each request within the same scope.
  • Singleton: A single instance of the object is created and shared across the entire application.

Additionally, you can also create a custom lifecycle by implementing the Microsoft.Extensions.DependencyInjection.IServiceScopeFactory interface

For more resources, visit the following links:

More Topics

Explore related content

View All Topics
Loved by 100K+ Developers

Start Your Learning
Journey Today

Join thousands of developers who are leveling up their skills with structured roadmaps and expert guidance

No credit card required
Always free
Track your progress