TooManyDataAnnotations 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TooManyDataAnnotations --version 1.0.0
                    
NuGet\Install-Package TooManyDataAnnotations -Version 1.0.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="TooManyDataAnnotations" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TooManyDataAnnotations" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="TooManyDataAnnotations" />
                    
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 TooManyDataAnnotations --version 1.0.0
                    
#r "nuget: TooManyDataAnnotations, 1.0.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 TooManyDataAnnotations@1.0.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=TooManyDataAnnotations&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=TooManyDataAnnotations&version=1.0.0
                    
Install as a Cake Tool

TooManyDataAnnotations

<p align="center"> <img src="https://gitlab.com/LuisAlfredo92/TooManyDataAnnotations/-/raw/main/TooManyDataAnnotations/Assets/icon.png" alt="TooManyDataAnnotations Icon" width="128"/> </p>

Extending .NET's System.ComponentModel.DataAnnotations with powerful, semantic validation attributes.

NuGet .NET 10.0


๐Ÿš€ Quick Start

Install the package:

dotnet add package TooManyDataAnnotations

Add validation to your models:

using System.ComponentModel.DataAnnotations;
using TooManyDataAnnotations.Aot.Network;
using TooManyDataAnnotations.Aot.Formatting;
using TooManyDataAnnotations.Aot.Text;
using TooManyDataAnnotations.Classes;

public class ProductDto
{
    [IPv4]
    public string? ServerIp { get; set; }

    [SemanticVersion]
    public string? Version { get; set; }

    [Required]
    [HexColor]
    public string? ThemeColor { get; set; }
}

[ExactlyOneOf(nameof(Email), nameof(Phone))]
public class ContactDto
{
    public string? Email { get; set; }
    public string? Phone { get; set; }
}

๐Ÿ“ฆ Two Packages Available

TooManyDataAnnotations (this package)

Everything included โ€” AOT-safe attributes + reflection-based validators.

Use this if you don't need Native AOT publishing.

TooManyDataAnnotations.Aot

AOT-only subset. Zero reflection. Use when publishing Native AOT applications.

dotnet add package TooManyDataAnnotations.Aot

๐Ÿ’ก Tip: Installing TooManyDataAnnotations automatically includes TooManyDataAnnotations.Aot as a dependency.


โœจ Supported Validators

AOT-Safe (no reflection)

Category Attributes
Identifiers [Guid], [GuidV7], [Uri]
Network [IPv4], [IPv6], [MacAddress], [PortNumber]
Text [HexColor], [Slug], [WebUrl]
Formatting [IsoDateTime], [SemanticVersion]
Logical [IsTrue], [IsFalse]

Reflection-Based (full package only)

Category Attributes
Logical [MinimumTrueValues], [AtLeastOneTrue], [ExactlyNTrue], [ExactlyOneTrue]
Classes [ExactlyNOf], [ExactlyOneOf], [RequiredAtLeastN], [RequiredAtLeastOne]
Temporal [StartDate], [EndDate]

๐Ÿงช Testing

899 unit tests covering all attributes โ€” valid/invalid inputs, edge cases, nullable types, custom error messages, and integration tests with Validator.TryValidateObject.

dotnet test


๐Ÿ“„ License

MIT License โ€” Copyright ยฉ 2026 LuisAlfredo92

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
1.0.1 104 8/2/2026
1.0.0 106 7/29/2026
0.1.0 101 7/21/2026