CustomModelFromQueryBinder<TModel> Class
Abstract base class for custom model binders that bind a model of type TModel from query string parameters.
public abstract class CustomModelFromQueryBinder<TModel> : HAKOM.Serialization.Http.Net.Api.ICustomModelFromQueryBinder, HAKOM.Serialization.Http.Net.Api.ICustomModelBinder, Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinderType parameters
Section titled “Type parameters”TModel
The type of model to bind from query parameters.
Inheritance System.Object 🡒 CustomModelFromQueryBinder<TModel>
Implements ICustomModelFromQueryBinder, ICustomModelBinder, Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder
Constructors
Section titled “Constructors”CustomModelFromQueryBinder() Constructor
Section titled “CustomModelFromQueryBinder() Constructor”Initializes a new instance of the CustomModelFromQueryBinder<TModel> class and caches the parameter names from Parameters.
protected CustomModelFromQueryBinder();Properties
Section titled “Properties”CustomModelFromQueryBinder<TModel>.Parameters Property
Section titled “CustomModelFromQueryBinder<TModel>.Parameters Property”Gets the collection of QueryParameter descriptors representing the query parameters used by this binder.
public abstract System.Collections.Generic.IEnumerable<HAKOM.Serialization.Http.Net.Api.QueryParameter> Parameters { get; }Implements Parameters
Property Value
Section titled “Property Value”System.Collections.Generic.IEnumerable<QueryParameter>
Methods
Section titled “Methods”CustomModelFromQueryBinder<TModel>.BindModel(ModelBindingContext, CancellationToken) Method
Section titled “CustomModelFromQueryBinder<TModel>.BindModel(ModelBindingContext, CancellationToken) Method”When overridden in a derived class, performs the actual model binding from query parameters.
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.
CustomModelFromQueryBinder<TModel>.BindModelAsync(ModelBindingContext) Method
Section titled “CustomModelFromQueryBinder<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”CustomModelFromQueryBinder<TModel>.CanBind(Type, BindingSource) Method
Section titled “CustomModelFromQueryBinder<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.
CustomModelFromQueryBinder<TModel>.TryGetValueProviderResult(string, ModelBindingContext, ValueProviderResult) Method
Section titled “CustomModelFromQueryBinder<TModel>.TryGetValueProviderResult(string, ModelBindingContext, ValueProviderResult) Method”Attempts to retrieve the value for the specified query parameter name from the binding context’s value provider, respecting any prefix from PrefixedQueryBindingSource.
protected virtual bool TryGetValueProviderResult(string name, Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext context, out Microsoft.AspNetCore.Mvc.ModelBinding.ValueProviderResult value);Parameters
Section titled “Parameters”name System.String
The name of the query parameter.
context Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext
The Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext containing the value provider.
value Microsoft.AspNetCore.Mvc.ModelBinding.ValueProviderResult
When this method returns true, contains the Microsoft.AspNetCore.Mvc.ModelBinding.ValueProviderResult.
Returns
Section titled “Returns”System.Boolean
true if a value was found; otherwise, false.