Cross-cutting capabilities solve concerns that apply to many use cases but should not be copied into every Handler. BitzOrcas places them in three locations: HTTP middleware owns transport context, the Mediator pipeline owns use-case semantics, and Infrastructure adapters own concrete external systems.
Three execution chains
HTTP middleware forwarded headers → public port → exceptions → localization → correlation → CORS / security headers → authentication / session guards → tenant/impersonation/language → request audit → authorization → rate limit → QUERY content validation → cache → timeout
Mediator pipeline logging → authorization → validation → pre-processing → idempotency → risk persistence → transaction → domain events → post-processing → activity audit
Infrastructure adapters database / CAP / Redis / file storage / external HTTP / OpenTelemetryThe boundary is practical: middleware does not know aggregates, a Handler does not know Redis or CAP, and an adapter does not decide whether a user may perform a business action.
Capability map
| Capability | Main entry | Developer concern |
|---|---|---|
| Error handling | Result<T>, Problem Details, global exception handler | Separate expected business failure from unexpected system failure |
| Validation | IRequestRule<T>, tenant validation strategies | Place format, access, tenant, and aggregate rules at the right layer |
| Data masking | Maskers and field policies | Authorize before masking and prevent log or export leakage |
| Idempotency | IIdempotentRequest, IIdempotencyStore | Key scope, TTL, multi-instance storage, concurrency window |
| Observability | ServiceDefaults, OTLP, CorrelationId | Correlate traces/logs/metrics without leaking sensitive data |
| Health checks | /health/live, /health/ready | Distinguish process life, configuration readiness, and connectivity |
| Rate limiting | ASP.NET Core RateLimiter | Partition key, 429 contract, proxy-aware addresses |
| Caching | Cache ports, Redis/Memory adapters | Key naming, tenant isolation, invalidation tags, degradation |
| Background jobs | JobHost, Quartz, Job Executor | Tenant scope, retries, audit, idempotency |
| HTTP resilience | HttpClient resilience pipeline | Timeout and retry boundaries, external-request audit |
| Realtime | Chat realtime adapter | Connection identity, tenant boundary, backpressure |
| Feature flags | Feature catalog, Store, and evaluator | Declaration, state, and enforcement are distinct |
| SSE | Currently a planned capability | Cursor, backpressure, proxy, scale, and revocation |
Defaults do not all mean the same thing
Core Runtime provides defaults for several ports, but their semantics differ:
- a Null Publisher may represent a genuinely optional notification;
- a Memory Store is suitable for local or single-instance development, not multi-instance readiness;
- an Unavailable Adapter exposes a missing dependency as a failed result;
- security, licensing, audit, and production persistence must not use a no-op implementation that returns success.
The useful question is not whether the process can start, but whether its runtime mode is explicit. An API Shell should report intentionally absent dependencies in readiness. A production profile should fail readiness or startup when a required capability is missing.
Adding a cross-cutting capability
- Decide whether it belongs to transport, use-case, or adapter semantics.
- Define failure and degradation behavior, especially for security and consistency.
- If order changes the outcome, keep it explicit in the composition root and test it.
- Keep
HttpContext, Redis clients, ORMs, and broker clients out of application ports. - Test tenant, cancellation, retry, and concurrency behavior.
Read a default implementation correctly
An interface, Null adapter, Memory store, or Endpoint registration does not prove a commercial capability. Determine the actual composition, whether production guards reject degradation, the exact Allow/Deny/Miss/exception behavior, whether state is shared across replicas, and which contract test proves end-to-end semantics.
This section records important boundaries: idempotency pipeline does not yet use atomic reservation; generic Feature enforcement maps only tickets/chat/workflow; several limiters remain process-local; Chat realtime is not strict post-commit and has no scale-out; SSE is not shipped; outbound HTTP audit buffers bodies and misses transport exceptions.
Recommended reading path
For a business use case, start with errors, authorization, and validation, then select idempotency, caching, jobs, and HTTP resilience for side effects. For production, review observability, health, limits, masking, and realtime together. Carry each page’s current-boundary and test matrix into module adoption rather than reading only happy paths.
- 01/14
Background Jobs
Design retry-safe, auditable, cancellable background work in the separate JobHost with correct tenant, idempotency, and failure semantics.
- 02/14
Functional Inbound Validation: IRequestRule and Anti-Corruption
Say goodbye to expensive validation exceptions! Master the BitzOrcas.Modern functional validation engine with IRequestRule declarative rules, pipeline guards, and typed error responses.
- 03/14
Caching
Build observable, degradable multi-level caches with FusionCache, Redis, and ICacheStore, including keys, negative caching, area catalog, warmup, and invalidation.
- 04/14
Interface Idempotency and Replay: Idempotency-Key in Action
Master BitzOrcas.Modern interface idempotency. Learn Idempotency-Key contracts, Redis/DB deduplication stores, concurrency mutexes, and historical response replays.
- 05/14
Domain Error Modeling and ErrorCatalog Standards
Say goodbye to unhandled exceptions! Learn how BitzOrcas.Modern implements domain error modeling with ErrorType hierarchies, Error factories, and compile-time ErrorCatalog generators.
- 06/14
Feature Flags
Manage capability rollout with global feature definitions, tenant overrides, authorization evaluation, and cache invalidation.
- 07/14
End-to-End Observability and Structured Auditing with OpenTelemetry
Explore the BitzOrcas.Modern observability engine. Learn OpenTelemetry distributed tracing, metrics export, and ActivityAudit pipeline audit trails.
- 08/14
Data Masking and Privacy Compliance: IDataMasker Guide
Master BitzOrcas.Modern enterprise data masking. Learn [Masked] contract attributes, dynamic phone/email/card masking algorithms, and GDPR-compliant log redaction.
- 09/14
HTTP Resilience
Understand the current outbound HTTP audit boundary and design integration-specific timeout, retry, circuit-breaker, and idempotency policies.
- 10/14
Global Exception Handling and RFC 9457 Problem Details
Explore the BitzOrcas.Modern error management architecture. Learn Result flow control, GlobalExceptionHandler catch-alls, and RFC 9457 Problem Details standards.
- 11/14
Health checks
Separate liveness, readiness, configuration consistency, and real dependency connectivity for Kubernetes and Aspire.
- 12/14
Multi-Tenant Rate Limiting and Anti-Scraping Protection
Master BitzOrcas.Modern enterprise rate limiting. Learn ASP.NET Core RateLimiter partition strategies (Sliding Window / Token Bucket), tenant quota isolation, and 429 guards.
- 13/14
Realtime
Current Chat SignalR adapter, persistent truth, membership authorization, reconnect recovery, and Null-composition boundary.
- 14/14
Server-Sent Events
Current non-delivery boundary for SSE and the protocol and operating requirements for a future implementation.