ModelValidator 1.0.0

dotnet add package ModelValidator --version 1.0.0
NuGet\Install-Package ModelValidator -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ModelValidator" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ModelValidator --version 1.0.0
#r "nuget: ModelValidator, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ModelValidator as a Cake Addin
#addin nuget:?package=ModelValidator&version=1.0.0

// Install ModelValidator as a Cake Tool
#tool nuget:?package=ModelValidator&version=1.0.0

ModelValidator

Example model:

public class ExampleModel : ModelValidatorBase
{
    /// <summary>
    /// Example string.
    /// </summary>
    [Required(AllowEmptyStrings = false, ErrorMessage = "Input text")]
    [StringLength(maximumLength: 10, MinimumLength = 4, ErrorMessage = "Min length: {1}, max length: {0}")]
    public string ExampleString { get; set; }

    /// <summary>
    /// Example int.
    /// </summary>
    [Range(minimum: 5, maximum: 10, ErrorMessage = "Min value: {0}, max value: {1}")]
    public int ExampleInt { get; set; }
}

Binding example:

<StackPanel>
    <TextBox Text="{Binding TestModel.ExampleString, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
    <TextBox Text="{Binding TestModel.ExampleInt, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
</StackPanel>
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 400 7/15/2020

Auto validation model for WPF