Interface IFormComponentBinder
Defines contract for binding form components.
public interface IFormComponentBinder
- Extension Methods
Methods
AddModelStateError(string, string)
Adds key with errorMessage to the model state.
void AddModelStateError(string key, string errorMessage)
Parameters
keystringerrorMessagestring
BindFormComponent(FormComponent, string, Predicate<string>)
Binds data to an instance of a model.
Task BindFormComponent(FormComponent model, string prefix, Predicate<string> propertyNameFilter = null)
Parameters
modelFormComponentForm component instance to which bind data from form collection.
prefixstringPrefix used in the form's inputs.
propertyNameFilterPredicate<string>Predicate, based on property names, to filter which properties are to be bound.
Returns
- Task
IsModelValid(string)
Checks whether model with specified prefix is valid.
bool IsModelValid(string prefix)
Parameters
prefixstring
Returns
- bool
True when model is valid, otherwise false.
PrebindComponentCollection(IEnumerable<FormComponent>, string)
Binds a collection of form components specified components while omitting
attribute and System.ComponentModel.DataAnnotations.IValidatableObject.Validate(System.ComponentModel.DataAnnotations.ValidationContext) validation.
Task PrebindComponentCollection(IEnumerable<FormComponent> components, string prefix)
Parameters
componentsIEnumerable<FormComponent>prefixstring
Returns
- Task
RemoveFromModelState(string)
Removes entries with specified prefix prefix from the model state.
void RemoveFromModelState(string prefix)
Parameters
prefixstring
Validate(object, string)
Validates the model and adds error into the model state.
void Validate(object model, string prefix)
Parameters
modelobjectObject to validate.
prefixstringKeys added into the model state are prefixed with this value and a single '.' character.