How do you manage Tenant-specific configurations in DI without polluting business logic?

Updated Apr 28, 2026

Short answer

Tenant configuration should be injected via the Options pattern dynamically resolved per-request, keeping the tenant logic strictly out of the domain.

Deep explanation

The DI container resolves an ITenantContext (scoped) based on the HTTP header. Then, it configures an IOptionsSnapshot<TenantSettings> based on that context. The business logic simply asks for TenantSettings and remains oblivious to how the tenant was identified.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Dependency Injection interview questions

View all →