# About

**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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://code-dispenser.gitbook.io/validated-docs/overview/about.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
