finds.dev← search

// the find

ardalis/Result

★ 1,037 · C# · MIT · updated Jul 2026

A result abstraction that can be mapped to HTTP response codes if needed.

Ardalis.Result is a Result pattern implementation for .NET that wraps service return values with typed status codes (Success, NotFound, Invalid, Forbidden, etc.) instead of throwing exceptions for expected failure cases. The companion AspNetCore package translates these results to HTTP responses automatically via an attribute or extension method. It's aimed at C# developers building APIs who are tired of exception-driven control flow for non-exceptional outcomes.

The ASP.NET Core integration is the real value here — `[TranslateResultToActionResult]` and `ToMinimalApiResult()` mean you write your service layer with zero HTTP knowledge and the adapter handles the mapping, including Swagger/OpenAPI metadata via `ResultConvention`. The `Bind`/`BindAsync` chaining lets you compose multi-step operations without nested null checks or repeated `if (!result.IsSuccess)` guards. FluentValidation integration is a first-class citizen, not an afterthought — `validation.AsErrors()` maps directly to `Result.Invalid()`. The library has no ASP.NET Core dependency in its core package, so domain services stay framework-agnostic.

The status code vocabulary is baked in — you get the statuses ardalis decided on, and adding a custom one (e.g., `PaymentRequired`, `TooManyRequests`) requires forking or wrapping. The `Bind` example in the README still shows the old manual pattern before demonstrating `BindAsync`, which will confuse newcomers reading linearly. At 1037 stars it's reasonably popular but not widely adopted enough that you can assume teammates will recognize the pattern; every new hire needs onboarding. There's no built-in mechanism for structured error metadata beyond `ValidationError` and free-text `Errors` strings — if you need machine-readable error codes for client consumption you'll bolt that on yourself.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →