Going beyond singleton, scoped, and transient lifetimes—tenant, pooled, and drifter
This is the first of two posts, and is largely a result of being nerd-sniped while listening to an episode of The Breakpoint Show which discussed dependency injection (DI) and the possible service lifetimes available. At various points Khalid, Maarten, and Woody discussed hypothetical “additional” lifetimes. This got me wondering how feasible it would be to create practical versions of those lifetimes. In this post I first briefly describe the standard lifetimes available in the .NET DI container. I then briefly describe the three hypothetical lifetimes described in the podcast. Finally, I show how you could implement one of these lifetimes in practice. In the next post I show a possible implementation for the remaining lifetime. ...