Interface IRequestBinder<TRequest>
create custom request binders by implementing this interface. by registering a custom modelbinder for an endpoint will completely disable the built-in model binding and completely depend on your implementation of the custom binder to return a correctly populated request dto for the endpoint.
Namespace: FastEndpoints
Assembly: FastEndpoints.dll
Syntax
public interface IRequestBinder<TRequest> where TRequest : notnull
Type Parameters
Name | Description |
---|---|
TRequest | the type of the request dto |
Methods
BindAsync(BinderContext, CancellationToken)
this method will be called by the library for binding the incoming request data and return a populated request dto object.
access the incoming request data via the RequestBinderContext
and populate a new request dto instance and return it from this method.
Declaration
ValueTask<TRequest> BindAsync(BinderContext ctx, CancellationToken ct)
Parameters
Type | Name | Description |
---|---|---|
BinderContext | ctx | request binder context encapsulating the incoming http request context, a list of validation failures for the endpoint, and an optional json serializer context. |
CancellationToken | ct | cancellation token |
Returns
Type | Description |
---|---|
ValueTask<TRequest> |