jbogard / MediatR

Simple, unambitious mediator implementation in .NET
Apache License 2.0
11.19k stars 1.18k forks source link

Result Pattern #1079

Closed devbrsa closed 1 month ago

devbrsa commented 1 month ago

Hi everyone,

Does anyone have an example or suggestions on how to implement monads or the result pattern with MediatR?

I’m looking for a way to return a Result with errors instead of throwing exceptions during validation, and registering this in the pipeline behavior.

Or a way to make the pipeline behavior always work with Result types.

Most examples I’ve found either rely on throwing exceptions or using libraries like ErrorOr, which is great, but I’m aiming for a simpler Result type.

Cheers, Thanks!

Prologh commented 1 day ago

There are plenty of libraries that can help you with that: