/CleanHandling

A clean way to deal with business logic and flows

Primary LanguageC#MIT LicenseMIT

CleanHandling

A clean way to deal with business logic and flows!

Write only the code that is important for your business rules, this library handle the errors flows, reducing boilerplate code.

First get the result from a mathod. Ex:

var result = await Result.Try(_session.SaveChangesAsync());

Then you can use the methods from the ResultExtension like:

var stringValueResult = result.Then(val => val.ToString());
Console.WriteLine(stringValueResult); // implicit convert result -> string
result.When(val => val is not null,
     @then: val => Result.From("Not Null"),
     @else: val => Result.From("Null"))

Real examples in the Finance Controlinator

image image