Quickstart
Welcome to the Validly Quickstart Guide! This page will help you get up and running with Validly in no time. By the end of this guide, you’ll have a basic understanding of how to validate your models
Install the Validly Packages
dotnet add package Validly
dotnet add package Validly.Extensions.Validators
dotnet add package Validly.SourceGeneratorAdd Validations to Your Class
[Validatable]
public partial class CreateUserRequest
{
[LengthBetween(5, 20)]
public required string Username { get; init; }
[MinLength(12)]
public required string Password { get; init; }
[EmailAddress]
public required string Email { get; init; }
[Between(18, 120)]
public required int Age { get; init; }
[NotEmpty]
public string? FirstName { get; init; }
[NotEmpty]
public string? LastName { get; init; }
}Validate Your Data
Add Custom Validation (Optional)
Method Parameters
Return Type
Using BeforeValidate and AfterValidate Hooks (Optional)
AfterValidate Method
Last updated