Skip to content

EndpointExtensions.ExecuteMethodAsync<TResponse> method

Executes an action method asynchronously and converts any exception to a service response.

public static Task<Result<TResponse>> ExecuteMethodAsync<TResponse>(this ControllerBase controller, 
    Func<Task<TResponse>> handler)
    where TResponse : ServiceResponse, new()
parameter description
TResponse The response type.
controller The controller.
handler The handler callback.

Return Value

The action result.

See Also