Instruction file imported from AkashSisaudiya/TravelWiseAI (
.github/instructions/backend.instructions.md). Copyright stays with the author.
Backend — C# Conventions
- New feature scaffold order: Domain entity → Application interface + DTO + handler + validator → Infrastructure impl → API controller
- Commands in
Application/{Feature}/Commands/, Queries inApplication/{Feature}/Queries/ - Handler returns
ErrorOr<T>— success viaResult.Success(value), failure viaError.Failure(...) - Validator class in same folder as its command/query, auto-registered via DI assembly scan
- Repository interface in
Application/Interfaces/, implementation inInfrastructure/Repositories/ - Controller actions: one line — dispatch to MediatR, map result to HTTP response
- Use
ICurrentUserServiceto access authenticated user — never read claims directly in handlers - Extension methods for DI registration: one
AddApplicationServices()per project CancellationTokenparameter on every handler and repository method