TooManyDataAnnotations 1.0.0
See the version list below for details.
dotnet add package TooManyDataAnnotations --version 1.0.0
NuGet\Install-Package TooManyDataAnnotations -Version 1.0.0
<PackageReference Include="TooManyDataAnnotations" Version="1.0.0" />
<PackageVersion Include="TooManyDataAnnotations" Version="1.0.0" />
<PackageReference Include="TooManyDataAnnotations" />
paket add TooManyDataAnnotations --version 1.0.0
#r "nuget: TooManyDataAnnotations, 1.0.0"
#:package TooManyDataAnnotations@1.0.0
#addin nuget:?package=TooManyDataAnnotations&version=1.0.0
#tool nuget:?package=TooManyDataAnnotations&version=1.0.0
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.DataAnnotationswith powerful, semantic validation attributes.
๐ 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
TooManyDataAnnotationsautomatically includesTooManyDataAnnotations.Aotas 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
๐ Links
- Solution README โ Full project documentation
- AOT Package โ AOT-only subset
๐ License
MIT License โ Copyright ยฉ 2026 LuisAlfredo92
| Product | Versions 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. |
-
net10.0
- TooManyDataAnnotations.Aot (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.