The post explores experimental dependency injection scopes beyond the standard Singleton, Scoped, and Transient lifetimes in .NET Core. It discusses hypothetical lifetimes such as tenant-scoped, pooled, and time-based (drifter) services, inspired by a podcast discussion. The post details implementations of these lifetimes, focusing particularly on time-based services, and highlights their characteristics and limitations. The implementation challenges, particularly with IDisposable services, are also covered.

18m read timeFrom andrewlock.net
Post cover image
Table of contents
Service lifetimes available in the .NET Core DI containerThe Breakpoint Show's additional lifetime scopesImplementing a simple time-based lifetime serviceSummary

Sort: