11

Understanding the Operation Result Design Pattern

This chapter explores the Operation Result pattern, starting simple and progressing to more complex cases. An operation result aims at communicating the success or the failure of an operation to its caller. It also allows that operation to return both a value and one or more messages to the caller.

Imagine any system in which you want to display user-friendly error messages, achieve some small speed gain, or even handle failure easily and explicitly. The Operation Result design pattern can help you achieve these goals. One way to use it is to handle the result of a remote operation, such as after querying a remote web service.

This pattern builds upon foundational object-oriented programming ...

Get An Atypical ASP.NET Core 6 Design Patterns Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.