AKlaus / DomainResult

Tiny package for decoupling domain operation results from IActionResult and IResult types of ASP.NET Web API
Apache License 2.0
53 stars 3 forks source link

Add conversion between IDomainResult<T> for different {T} #3

Closed AKlaus closed 3 years ago

AKlaus commented 3 years ago

There is a need for propagating a IDomainResult state (received from a nested call) up. The nested response type can be different from the type of the parent method.

Suggested use:

private IDomainResult<int> Foo()
{
   IDomainResult<string> res = FooNested();
   if (!res.IsSuccess)
     return res.ConvertTo<int>();
}

The same for converting IDomainResult<T> to IDomainResult and vice versa.

AKlaus commented 3 years ago

Addressed in #5 PR