service lifetime

How long the container keeps and reuses an instance of a service: transient, scoped or singleton.

In more detail

Choose it by asking where the state belongs: nowhere (transient), to one request (scoped), or to the whole process (singleton). A longer-lived service must never hold a shorter-lived one.

Related terms

Taught in

References