zentient results api reference Integration Points - ulfbou/Zentient.Results GitHub Wiki
Namespace:
Zentient.ResultsAssembly:Zentient.Results.dllAvailable since:v0.3.0
Zentient.Results integrates seamlessly into ASP.NET Core applications by enabling structured and protocol-neutral handling of operation outcomes through IResult and IResult<T>. These abstractions allow for consistent error propagation, diagnostics, and status mapping, independent of transport protocols.
While manual integration works today, official support for HTTP-based pipelines is being developed in the pre-release library Zentient.Endpoints.Http (part of the upcoming Zentient.Endpoints module suite).
Until the release of full HTTP adapters, developers can implement lightweight bridges between IResult and IActionResult.
app.MapPost("/users", async (UserDto dto, IUserService service) =>
{
IResult<User> result = await service.CreateUserAsync(dto);
return result.IsSuccess
? Results.Ok(result.Value)
: Results.Problem(result.ToProblemDetails());
});[HttpGet("{id}")]
public IActionResult GetUser(Guid id)
{
var result = _service.GetById(id);
if (result.IsSuccess)
return Ok(result.Value);
return StatusCode(result.Status.Code, result.ToProblemDetails());
}The following libraries are in active development and will provide drop-in support for ASP.NET Core:
| Library | Purpose |
|---|---|
| Zentient.Endpoints.Http | Adapter and conversion layer for IResult โ IActionResult, full ProblemDetails compliance, HTTP status code mapping, and error serialization. |
| Zentient.Endpoints.Core | Shared abstractions and pipelines for mapping results across transport protocols. |
| Zentient.Telemetry | Extension points for enriching and observing results via logging, tracing, and diagnostics. |
These modules will be incrementally published starting from v0.5.0 as part of the
Zentient.Endpointsroadmap.
return Results.Problem(result.ToProblemDetails());This method creates a standards-compliant problem document (based on RFC 9457) using data from ErrorInfo.
return StatusCode(result.Status.Code, result.ToProblemDetails());Respects the semantic status attached to the result and reflects its meaning in HTTP form.
var result = await userService.CreateUserAsync(dto)
.Then(user => auditService.RecordCreation(user))
.Map(_ => "User created");You can wrap the final result into an IActionResult once the processing pipeline completes.
| Feature | Description |
|---|---|
| โ Automatic IActionResult Conversion |
IResult and IResult<T> will be automatically converted using a result adapter. |
| ๐ RFC 9457 ProblemDetails Output | Failures will be serialized as Problem Details for HTTP APIs with full structure and metadata. |
| ๐ Observability Hooks | Integrated telemetry injection via Zentient.Telemetry. |
| โ๏ธ Pluggable Policies | Full control over HTTP code mapping, problem shape, headers, and filters. |
| ๐งฉ Minimal API Extensions | Fluent registration and middleware like .WithZentientResults() for endpoint pipelines. |
- Zentient.Results is transport-agnostic by contract and does not depend on ASP.NET Core.
-
ToProblemDetails()provides structured, machine-readable, and human-friendly error output aligned withErrorInfoandIResultStatus. - The upcoming adapters in
Zentient.Endpoints.Httpwill formalize integration patterns, allowing your domain to remain pure and framework-independent.
The following roadmap outlines the status and targets of integration support within the Zentient ecosystem. All dedicated endpoint libraries begin at version v0.1.0 as pre-release packages under active development.
| Layer | Status | Target Release |
|---|---|---|
| Minimal APIs | โ Supported via manual wrapping |
Zentient.Endpoints.Http v0.1.0 |
| Controller Actions | โ
Supported via ToProblemDetails()
|
Zentient.Endpoints.Http v0.1.0 |
| ProblemDetails (RFC 9457) | โ Manually supported |
Zentient.Endpoints.Http v0.1.0 |
| Telemetry Injection | ๐ง In development |
Zentient.Telemetry v0.1.0 |
| Error Handling Middleware | ๐ง In development |
Zentient.Endpoints.Http v0.1.0 |
| gRPC Integration | ๐ Planned |
Zentient.Endpoints.Grpc v0.1.0 |
| Messaging Transports | ๐งช Experimental |
Zentient.Endpoints.Messaging v0.1.0 |
All components will conform to RFC 9457 โ Problem Details for HTTP APIs to ensure interoperable, machine-readable error semantics across all transport boundaries.
You can track progress and preview these adapters in the Zentient.Endpoints repository.
ToProblemDetails()ExtensionErrorInfoIResultResultStatus- RFC 9457 โ Problem Details for HTTP APIs
- Minimal APIs in ASP.NET Core
#ASP.NETCore #Integration #ProblemDetails #HTTPAdapters #ZentientEndpoints #RFC9457 #StableContract
Last Updated: 2025-06-22 Version: 0.4.0