![google earth 5.0 google earth 5.0](https://img.informer.com/pe/GEP-v5-main-screen.png)
ValidationResult result = await Validator.ValidateAsync(fluentValidationContext) ĪddValidationResult(fieldIdentifier.Model, result) ValidatorSelector: new (propertiesToValidate) InstanceToValidate: fieldIdentifier.Model, public class FluentValidationValidator : ComponentBase Then create a class called FluentValidationValidator. The purpose of embedding inside the mark-up is so that we can define a Cascading parameter to pick up the current EditContext that is created by the EditForm whenever its Model parameter changes.įirst, create a new Blazor app and add a reference to the FluentValidation NuGet package. It’s only requirement is that it descends from the Blazor ComponentBase class so that we can add it inside the mark-up in our view. Our validator component does not have to descend from any specific class in order to provide validation.
![google earth 5.0 google earth 5.0](https://www.geofumadas.com/wp-content/uploads/2009/02/google-earth-5.06.jpg)
Once you’ve finished this section (or if you just want something you can use straight away), please have a look a blazor-validation. Our custom validation will be based on FluentValidation. The previous EditContext (which is no longer needed because it contains information about the previous model) can then be garbage collected, and with it all instances of classes that are grouped in the diagram. Remember, whenever EditForm.Model is altered, the EditForm will create a new instance of EditContext. The following UML diagram shows the relationship between an EditForm, and the various classes (grouped in the diagram) that store this meta-state.
#GOOGLE EARTH 5.0 HOW TO#
To understand how it works, this section will explain how to create our own custom validation mechanism that can be used with Blazor to validate user input. In addition to indicating whether a value has been manually edited or not, Blazor stores a collection of validation error messages. Note that, as with the section on EditContext, FieldIdentifiers, and FieldState, this is an advanced topic.Īs mentioned previously, the FieldState class holds meta-state for form data.