> For the complete documentation index, see [llms.txt](https://code-dispenser.gitbook.io/validated-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-dispenser.gitbook.io/validated-docs/overview/about.md).

# About

A functional approach to validation in C#. Validated provides a composable, functional validation framework for .NET applications. It’s designed to make validation predictable, testable, and reusable

**Validated.Core** is a modern, functional, and highly-composable validation library for .NET. It is designed to provide a robust and flexible validation framework that separates validation logic from your business logic, making your code cleaner, more maintainable, and easier to test.

### Key Features

* **Functional First:** At its core, `Validated.Core` embraces a functional approach to validation. It uses a `Validated<T>` type to represent the result of a validation, which can be either a valid value or a collection of validation failures. This design allows you to chain validation rules together in a fluent and expressive way, creating complex validation logic from simple, reusable building blocks.
* **Configuration-Driven Validation:** With `Validated.Core`, you can define your validation rules in a configuration source and apply them dynamically at runtime. This is particularly useful in enterprise applications where validation rules may need to change without recompiling the application.
* **Multi-Tenancy and Localization:** The library has built-in support for multi-tenant and multi-culture validation scenarios. You can define different validation rules and error messages for different tenants and cultures, and `Validated.Core` will automatically resolve the most appropriate rules based on the current context.
* **Versioning:** `Validated.Core` supports versioning of validation rules, allowing you to evolve your validation logic over time without breaking existing functionality. When multiple versions of the same rule exist, the system will use the latest version.
* **Extensible:** The library is designed to be extensible. You can create your own custom validator factories and register them with the `ValidatorFactoryProvider` to support new validation scenarios.
* **Asynchronous Support:** `Validated.Core` fully supports asynchronous validation, allowing you to perform validation that involves I/O operations, such as database lookups or API calls.

### How It Works

The library is built around a few core concepts:

* **`Validated<T>`:** A type that represents the result of a validation. It can be in one of two states: `Valid` (containing a value) or `Invalid` (containing a list of `InvalidEntry` records).
* **`MemberValidator<T>` and `EntityValidator<T>`:** These are delegates that represent the validation logic for a single property or an entire entity, respectively.
* **`ValidationBuilder<TEntity>` and `TenantValidationBuilder<TEntity>`:** These are fluent builders that you can use to compose validators for your entities. The `ValidationBuilder` is used for manual composition, while the `TenantValidation_Builder` is used for configuration-driven validation.

By combining these concepts, you can create a validation system that is tailored to your specific needs, whether you're building a simple application or a large, complex enterprise system.

**GitHub Repository:** <https://github.com/code-dispenser/Validated><br>

### Blazor users

A separate NuGet package **Validated.Blazor** is now available which contains builders that enables you to make your existing validators work with Blazor's `<EditForm>` and `EditContext`

**Documentation**: <https://code-dispenser.gitbook.io/validated-blazor-docs/>

**GitHub Repository:** <https://github.com/code-dispenser/Validated-Blazor>
