Project – Implementing different Operation Result patterns
In this project, a consumer routes the HTTP requests to the right handler. We are visiting each of those handlers one by one, which will help us implement simple to more complex operation results. This should show you the many alternative ways to implement the Operation Result pattern to help you understand it, make it your own, and implement it as required in your projects.
The consumer
The consumer in all examples is the Startup
class. The following code routes the request toward a handler:
app.UseRouter(builder => { builder.MapGet("/simplest-form", SimplestFormHandler); builder.MapGet("/single-error", SingleErrorHandler); builder.MapGet("/single-error-with-value", SingleErrorWithValueHandler); builder.MapGet("/multiple-errors-with-value", MultipleErrorsWithValueHandler...