Class MvvmObservableValidator
- Namespace
- Blazing.Mvvm.Components
- Assembly
- Blazing.Mvvm.dll
A Blazor component that adds validation support to an Microsoft.AspNetCore.Components.Forms.EditContext for models inheriting from CommunityToolkit.Mvvm.ComponentModel.ObservableValidator. Falls back to the default behaviour and uses the built-in Microsoft.AspNetCore.Components.Forms.DataAnnotationsValidator for models that do not inherit from CommunityToolkit.Mvvm.ComponentModel.ObservableValidator.
public sealed class MvvmObservableValidator : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposableInheritance
Implements
Inherited Members
Methods
Dispose()
Disposes the validation handler and releases resources.
public void Dispose()OnInitialized()
Initializes the component and sets up validation for the Microsoft.AspNetCore.Components.Forms.EditContext.
protected override void OnInitialized()Exceptions
- InvalidOperationException
-
Thrown if Blazing.Mvvm.Components.MvvmObservableValidator.CurrentEditContext is
null.
OnParametersSet()
Checks if the Microsoft.AspNetCore.Components.Forms.EditContext has changed and throws if it has, as dynamic changes are not supported.
protected override void OnParametersSet()Exceptions
- InvalidOperationException
-
Thrown if the Microsoft.AspNetCore.Components.Forms.EditContext is changed dynamically.