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...