CustomModelFromBodyBinder<TModel> Class
Abstract base class for custom model binders that bind a model of type TModel from the HTTP request body.
public abstract class CustomModelFromBodyBinder<TModel> : HAKOM.Serialization.Http.Net.Api.ICustomModelBinder, Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinderType parameters
Section titled “Type parameters”TModel
The type of model to bind from the request body.
Inheritance System.Object 🡒 CustomModelFromBodyBinder<TModel>
Implements ICustomModelBinder, Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder
Methods
Section titled “Methods”CustomModelFromBodyBinder<TModel>.BindModel(ModelBindingContext, CancellationToken) Method
Section titled “CustomModelFromBodyBinder<TModel>.BindModel(ModelBindingContext, CancellationToken) Method”When overridden in a derived class, performs the actual model binding from the request body.
protected abstract System.Threading.Tasks.Task BindModel(Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext bindingContext, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Parameters
Section titled “Parameters”bindingContext Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext
The Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext for the current request.
cancellationToken System.Threading.CancellationToken
A System.Threading.CancellationToken to signal cancellation.
Returns
Section titled “Returns”System.Threading.Tasks.Task
A System.Threading.Tasks.Task that completes when binding is finished.
CustomModelFromBodyBinder<TModel>.BindModelAsync(ModelBindingContext) Method
Section titled “CustomModelFromBodyBinder<TModel>.BindModelAsync(ModelBindingContext) Method”public System.Threading.Tasks.Task BindModelAsync(Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext bindingContext);Parameters
Section titled “Parameters”bindingContext Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext
Implements BindModelAsync(ModelBindingContext)
Returns
Section titled “Returns”CustomModelFromBodyBinder<TModel>.CanBind(Type, BindingSource) Method
Section titled “CustomModelFromBodyBinder<TModel>.CanBind(Type, BindingSource) Method”Determines whether this binder can bind the specified modelType from the given bindingSource.
public virtual bool CanBind(System.Type modelType, Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource? bindingSource);Parameters
Section titled “Parameters”modelType System.Type
The System.Type of the model to bind.
bindingSource Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource
The Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource indicating where the data originates, or null.
Implements CanBind(Type, BindingSource)
Returns
Section titled “Returns”System.Boolean
true if this binder supports the specified model type and binding source; otherwise, false.