liveBook · Manning

Transient lifetime

A transient lifetime is a dependency-injection policy that creates a new service instance each time the service is requested or resolved.

How 2 Manning books explain it

ASP.NET Core in Action, 3e

A transient lifetime is a dependency-injection lifetime policy that creates a new service instance each time the service is requested.

How it is used
Uses transient registration for lightweight, mostly stateless services that should never be reused across dependency requests.
How deep it goes
Explains instance creation within dependency graphs, object volume, manual scopes, and lifetime safety, but stops short of container internals.
Examples
Demonstrates unique DataContext and Repository instances through AddTransient registrations, RowCount values, an endpoint handler, and repeated API calls.
What you can do after
Operate/configure it through ASP.NET Core AddTransient registrations and diagnose incorrect root-container resolution or lifetime capture.

Read how ASP.NET Core in Action, 3e explains transient lifetime →

.NET MAUI in Action

A transient scope is a dependency-injection lifetime in which a new service instance is created each time the service is requested.

How it is used
Registers pages and view models that should be newly created whenever dependency injection resolves them.
How deep it goes
Explains lifetime trade-offs, navigation expectations, state concerns, and the AddTransient registration step.
Examples
Demonstrates transient registration with LoginPage in MauiProgram.cs and compares it with Shell-managed pages and singleton services.
What you can do after
Operate/configure .NET MAUI dependency injection by registering a page with AddTransient and selecting lifetimes by navigation and state needs.

Read how .NET MAUI in Action explains transient lifetime →

Also covered in

Related concepts

Questions about transient lifetime

What is transient lifetime?

A transient lifetime is a dependency-injection policy that creates a new service instance each time the service is requested or resolved.

Which Manning books explain transient lifetime?

ASP.NET Core in Action, 3e and .NET MAUI in Action.

What is transient lifetime a kind of?

Transient lifetime is a kind of service. A service is an application component that provides a defined capability to other components, typically through an interface.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.