Zhomfr.Validation.Rules.Database 0.6.0

dotnet add package Zhomfr.Validation.Rules.Database --version 0.6.0
                    
NuGet\Install-Package Zhomfr.Validation.Rules.Database -Version 0.6.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Zhomfr.Validation.Rules.Database" Version="0.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zhomfr.Validation.Rules.Database" Version="0.6.0" />
                    
Directory.Packages.props
<PackageReference Include="Zhomfr.Validation.Rules.Database" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Zhomfr.Validation.Rules.Database --version 0.6.0
                    
#r "nuget: Zhomfr.Validation.Rules.Database, 0.6.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Zhomfr.Validation.Rules.Database@0.6.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Zhomfr.Validation.Rules.Database&version=0.6.0
                    
Install as a Cake Addin
#tool nuget:?package=Zhomfr.Validation.Rules.Database&version=0.6.0
                    
Install as a Cake Tool

Validation Rules for Database

NuGet Status NuGet Downloads

⚠️ Warning: Active Development (< 1.0.0)

Prior to the release of stable version 1.0.0, this library follows SemVer for initial development. This means breaking changes may occur even in minor releases (0.x).

We strongly recommend pinning the package version in your .csproj to avoid unexpected build errors.

A powerful, intuitive collection of custom validation attributes built directly on top of the standard .NET System.ComponentModel.DataAnnotations infrastructure. Designed to eliminate boilerplate code, this library brings a rich set of production-ready validation rules—inspired by robust ecosystem standards (like Laravel's validation features) — allowing you to validate models cleanly using declarative attributes without reinventing the wheel.

Key Features

  • Standard DataAnnotations Integration: Seamlessly works with ASP.NET Core, Entity Framework, and standard Validator methods out of the box.
  • Rich Set of Built-in Rules: Covers frequent validation scenarios that are missing from standard .NET, preventing you from writing repetitive custom validators over and over again.
  • Intuitive Declarative Syntax: Clean and expressive attributes to keep your domain models and DTOs readable and maintainable.
  • Customizable Error Messages: Fully supports localized and custom error message templates via standard ErrorMessage properties.

📦 Installation

Install package:

dotnet add package Zhomfr.Validation.Rules.Database

After add namespace in using section:

using Zhomfr.Validation.Rules.Database;

Available Methods

<table> <tr valign="top"> <td>

</td> </tr> </table>

🛠️ Features and Examples

Exist

Validates that a record with the specified property value exists in the database. Supports any entity type and property that can be resolved via .

public class StubModel
{
    [Exist<StubDbContext,StubEntity>(nameof(StubEntity.Name))]
    public string Name { get; set; } = "user@example.com";
}

Unique

Validates that the value is unique within the specified database table and column. This rule fails if a record with the same property value already exists.

public class StubModel
{
    [Unique<StubDbContext,StubEntity>(nameof(StubEntity.Name))]
    public string Name { get; set; } = "user@example.com";
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.0 49 10/24/2026
0.5.0 49 10/23/2026
0.4.1 42 10/23/2026
0.4.0 43 10/22/2026
0.3.0 41 10/22/2026