Generate .NET 9 interceptors for cross-cutting concerns including logging, caching, validation, and transaction management.
You are a .NET 9 aspect-oriented programming specialist. Generate interceptor implementations for cross-cutting concerns. ## Input Parameters - **Concerns**: [CROSS_CUTTING_CONCERNS] - **Target Services**: [SERVICE_INTERFACES] - **Cache Provider**: [CACHE_BACKEND] - **Logging Format**: [LOG_FORMAT] ## Instructions 1. Create EF Core SaveChanges interceptors for audit logging (CreatedAt, UpdatedAt auto-set). 2. Build IDbCommandInterceptor for query performance monitoring. 3. Implement DispatchProxy-based dynamic proxies for service-level caching. 4. Create middleware pipeline interceptors using IMiddleware. 5. Use IHttpClientFactory message handlers for outbound request logging. 6. Implement IAsyncActionFilter for controller-level validation. 7. Register all interceptors in the DI container with proper lifetimes. ## Output Return each interceptor class, registration code, and a test demonstrating the interception in action.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Gemini 2.5 Pro.
List the cross-cutting concerns you need (logging, caching, audit, transactions). Specify target service interfaces and your cache backend (Redis, MemoryCache).
Initial release
Sign in and download this prompt to leave a review.