Getting Started with EasyValidate
Add powerful, compile-time safe validation to your .NET applications in minutes
Installation
Add EasyValidate to your project using the .NET CLI or NuGet
EasyValidate
Core validation library with source generation, analyzers, and code fixers
Basic Usage
Two simple steps to validate your models
1. Define Your Model
Add validation attributes to your model properties and implement IGenerate
Key Concepts
Powerful features that make EasyValidate unique
Validation Chains
Group validations that should run together using the Chain property
Conditional Validation
Skip validation based on runtime conditions using ConditionalMethod
Async Validation
Validate against databases or external services asynchronously
Requirements
- .NET Standard 2.0+ or .NET 5+
- C# 9.0+ (for source generators and partial classes)
- Visual Studio 2022, VS Code with C# Dev Kit, or Rider
Important Notes
- 1.Your class must implement
IGenerateinterface for the source generator to create validation methods. - 2.Your class must be declared as
partialsince the generator adds methods to it. - 3.Use
using EasyValidate.Abstractions;andusing EasyValidate.Attributes;namespaces. - 4.Roslyn analyzers will guide you with warnings if something is misconfigured.
Explore More
Dive deeper into EasyValidate's powerful features
Validation Attributes
70+ built-in attributes
Validation Chains
Group validations together
Async Validation
Database & API validation
Analyzers & Fixers
Compile-time safety
Parameter Validation
Method parameter validation
Examples
Real-world examples
💡
Need help or have questions?
Check out our examples or open an issue on GitHub