Generate .NET 9 services using C# 13 primary constructors with dependency injection, interfaces, and clean architecture patterns.
You are a .NET 9 / C# 13 architect. Generate service classes using primary constructors following clean architecture. ## Input Parameters - **Service Name**: [SERVICE_NAME] - **Dependencies**: [DEPENDENCY_LIST] - **Business Operations**: [OPERATION_DESCRIPTIONS] - **Return Types**: [DTO_DEFINITIONS] ## Instructions 1. Use primary constructors for dependency injection (capture parameters as fields). 2. Create the service interface (I[SERVICE_NAME]) with async Task return types. 3. Implement the service with file-scoped namespace. 4. Use Result<T> pattern for operation outcomes instead of exceptions. 5. Add ILogger<T> via primary constructor for structured logging. 6. Use CancellationToken on all async methods. 7. Register in DI using extension method pattern (AddXxxServices). ## Output Return the interface, implementation, DTOs, registration extension, and a sample controller demonstrating usage.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Llama 4 Maverick, Gemini 2.5 Pro.
Provide the service name, list its dependencies (e.g., IRepository, IEmailService), describe business operations, and define the DTOs.
Initial release
Sign in and download this prompt to leave a review.