Class ValueObjectModelBinder<TSelf, TValue>
Namespace: AdCodicem.ValueObjects.AspNetCore.ModelBinding
Assembly: AdCodicem.ValueObjects.AspNetCore.dll
Binds a value object from the raw text of a route segment, query string value, header or form field.
public sealed class ValueObjectModelBinder<TSelf, TValue> : IModelBinder where TSelf : struct, IValueObject<TSelf, TValue>
Type Parameters
TSelf
Value object type.
TValue
Underlying value type.
Inheritance
object ← ValueObjectModelBinder<TSelf, TValue>
Implements
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
The binder is closed over the concrete value object type, so binding costs one TryParse and nothing
else: no reflection, no TypeDescriptor lookup, and no exception on the rejection path. The violated
rule travels with the model error so that
Methods
BindModelAsync(ModelBindingContext)
Attempts to bind a model.
public Task BindModelAsync(ModelBindingContext bindingContext)
Parameters
bindingContext ModelBindingContext
The
Returns
A
If model binding was successful, the true.
A model binder that completes successfully should set