Skip to main content

Payroll Tenant Context

Summary

Payroll combines request-derived tenant context, explicit tenant predicates, EF Core query filters, and event-envelope tenant identity.

Audience

Backend and frontend developers, QA and DevOps engineers, support and security engineers, and solution architects.

Overview

Payroll combines request-derived tenant context, explicit tenant predicates, EF Core query filters, and event-envelope tenant identity.

Technical Detail

Request context

A scoped tenant-context abstraction resolves tenant identity and actor context from the forwarded request. Application services may accept an explicit tenant argument and frequently query with explicit tenant predicates. Exact claims, headers, configuration names, and fallback behavior are intentionally excluded.

Persistence filters

Most tenant-owned entities have global query filters. Services often bypass filters for cross-context retrieval and then apply an explicit tenant condition. Correct predicate use is therefore part of the application boundary, not a universal automatic assurance.

Consumer context

Inbound events must carry a valid tenant identity. The consumer uses that identity when locating or creating projections and records skipped processing when tenant context is absent.

Protection responsibilities

Gateway authentication, service authorization, tenant-context validation, and explicit query scoping must work together. Privileged cross-tenant behavior and hard failure for every missing-tenant path Require confirmation.

Source References

  • microservices/src/payroll-service/Application/Common/Abstractions.cs
  • microservices/src/payroll-service/Infrastructure/Persistence.cs
  • microservices/src/payroll-service/Infrastructure/PayrollDbContext.cs
  • microservices/src/payroll-service/Application/PayrollCalculationService.cs
  • microservices/src/payroll-service/Messaging/PayrollReadModelConsumer.cs

See Also

Keywords

  • Payroll Service
  • Payroll Tenant Context
  • Technical architecture

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-15
  • Review cycle: Quarterly