What problem does it solve?
Provides a consistent, production-ready approach to representing expected failures and unexpected errors in ASP.NET APIs so controllers return uniform, machine-readable error responses instead of ad-hoc strings or thrown exceptions.
Core Features & Use Cases
- Uses Ardalis.Result to model typed outcomes (Success, NotFound, Invalid, Conflict, Error) so handlers avoid throwing for expected flow control.
- Enforces request validation via a MediatR ValidationBehavior with FluentValidation to ensure handlers only receive valid requests.
- Maps domain results to HTTP automatically using result.ToActionResult in controllers and returns ProblemDetails (RFC 9457) for API errors.
- Provides a GlobalExceptionMiddleware to log unhandled exceptions and return RFC-compliant ProblemDetails 500 responses.
- Use case: build CRUD endpoints that return consistent status codes for not-found, validation errors, conflicts, and unexpected server faults.
Quick Start
Return typed Ardalis.Result from handlers, register ValidationBehavior and FluentValidation in DI, and map responses in controllers using result.ToActionResult(this).