You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a regular user of FluentResults and greatly appreciate the flexibility it provides for handling success and failure scenarios in a functional style. However, I often work in scenarios where it would be beneficial to extend the library to better support Railway-Oriented Programming (ROP) by introducing a Result<TValue, TRequest> type.
Proposal
I propose extending the library to include a generic Result<TValue, TRequest> type. This extension would allow users to not only return the result (TValue) but also retain information about the original request (TRequest). This is particularly useful in scenarios where it’s important to maintain context, such as when needing to reference the ID of the original request.
Example
Here’s an example of how this feature could be used:
publicclassEntity{publicGuidId{get;set;}publicstringName{get;set;}}publicclassCreateEntityRequest{publicGuidRequestId{get;set;}publicstringName{get;set;}}publicclassEntityService{publicResult<Entity,CreateEntityRequest>CreateEntity(CreateEntityRequestrequest){if(string.IsNullOrEmpty(request.Name)){return Result.Fail<Entity,CreateEntityRequest>("Entity name cannot be empty", request);}varentity=new Entity
{Id= Guid.NewGuid(),Name= request.Name
};return Result.Ok<Entity,CreateEntityRequest>(entity, request);}}
I believe this feature would be a valuable addition to FluentResults and would greatly simplify certain types of workflows. I'm happy to discuss this further or provide additional examples if needed.
Thanks for considering this!
Best regards,
Martin
The text was updated successfully, but these errors were encountered:
Hi everyone,
I'm a regular user of FluentResults and greatly appreciate the flexibility it provides for handling success and failure scenarios in a functional style. However, I often work in scenarios where it would be beneficial to extend the library to better support Railway-Oriented Programming (ROP) by introducing a
Result<TValue, TRequest>
type.Proposal
I propose extending the library to include a generic
Result<TValue, TRequest>
type. This extension would allow users to not only return the result (TValue) but also retain information about the original request (TRequest). This is particularly useful in scenarios where it’s important to maintain context, such as when needing to reference the ID of the original request.Example
Here’s an example of how this feature could be used:
I believe this feature would be a valuable addition to FluentResults and would greatly simplify certain types of workflows. I'm happy to discuss this further or provide additional examples if needed.
Thanks for considering this!
Best regards,
Martin
The text was updated successfully, but these errors were encountered: