Info
Version: | 1.0.1 |
Author(s): | John Kevin Cheng |
Last Update: | Tuesday, December 29, 2020 |
.NET Fiddle: | Create the first Fiddle |
Project Url: | https://github.com/johnkevincheng/ScissorValidations |
NuGet Url: | https://www.nuget.org/packages/RockFluid.ScissorsValidation |
Install
Install-Package RockFluid.ScissorsValidation
dotnet add package RockFluid.ScissorsValidation
paket add RockFluid.ScissorsValidation
RockFluid.ScissorsValidation Download (Unzip the "nupkg" after downloading)
Dependencies
Tags
Sample usage: Add the validator attributes to the properties of the data record class.
These defines the validation rules.
public class Employee
{
[StringValidator("First Name", 5, 50, IsRequired = true)]
public String FirstName { get; set; }
[DoubleValidator("Rating", 0.0, 5.0, IsRequired = true)]
public Single Rating { get; set; }
[DateValidator("Date Employed", "2017-07-05")]
public DateTime DateEmployed { get; set; }
}
To start the validation, call the Validate() function on the class instance that contains data to be validated.
var validation = RockFluid.ScissorValidations.Validator.Validate(p);
The validation result contains information if the validation found issues, with the list of validation results.
Refer to the wiki for how to configure in more detail: https://github.com/johnkevincheng/ScissorValidations/wiki
1.0.1
Validate() overload without need for a mapping dictionary. This can only validate data already copied to the class object, thus cannot validate from the user interface, but can be useful for import sources.
1.0.0
Initial release.