Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

captive dependency

A long-lived object holding on to a short-lived one, so it outlives its time.

A captive dependency occurs when a longer-lived service (a singleton) depends on a shorter-lived one (scoped or transient), extending that dependency's lifetime; scope validation reports it.

Examples

  • A singleton cache that takes a scoped DbContext in its constructor keeps that one context for the life of the app.

Read the full section →