RzR.Validation.Attributes
3.0.0.6710
dotnet add package RzR.Validation.Attributes --version 3.0.0.6710
NuGet\Install-Package RzR.Validation.Attributes -Version 3.0.0.6710
<PackageReference Include="RzR.Validation.Attributes" Version="3.0.0.6710" />
<PackageVersion Include="RzR.Validation.Attributes" Version="3.0.0.6710" />
<PackageReference Include="RzR.Validation.Attributes" />
paket add RzR.Validation.Attributes --version 3.0.0.6710
#r "nuget: RzR.Validation.Attributes, 3.0.0.6710"
#:package RzR.Validation.Attributes@3.0.0.6710
#addin nuget:?package=RzR.Validation.Attributes&version=3.0.0.6710
#tool nuget:?package=RzR.Validation.Attributes&version=3.0.0.6710
RzR.Validation.Attributes is a .NET library that extends System.ComponentModel.DataAnnotations with ~58 ready-to-use ValidationAttribute subclasses covering presence checks, comparisons, string rules, date/time constraints, format patterns, identity validation, collection guards, conditional requirements, and object-level cross-property rules. Every attribute plugs directly into the standard Validator API - no extra infrastructure needed.
Install-Package RzR.Validation.Attributes
Features at a glance
| Category | Count | Example attributes |
|---|---|---|
| Presence / Required | 6 | ValRequiredNotNull, ValRequiredNotEmpty, ValRequiredNotDefault, ValRequiredPositive, ValNotWhiteSpace, ValGuidNotEmpty |
| Comparison | 7 | ValGreaterThan, ValGreaterThanOrEqual, ValLessThan, ValLessThanOrEqual, ValBetween, ValEqual, ValNotEqual |
| Collections & sets | 3 | ValCollectionNotEmpty, ValAllowedValues, ValDeniedValues |
| Conditional & cross-property | 3 | ValRequiredIf, ValRequiredUnless, ValCompareProperty |
| Object-level (class-targeted) | 4 | ValAtLeastOneOf, ValMutuallyExclusive, ValExactlyOneOf, ValChronological |
| Date & time | 3 | ValNotFuture, ValNotPast, ValMinAge |
| Numeric | 5 | ValDecimalPrecision, ValMultipleOf, ValPercentage, ValLatitude, ValLongitude |
| String | 11 | ValLengthRange, ValMinLength, ValMaxLength, ValExactLength, ValStartsWith, ValEndsWith, ValContains, ValRegex, ValAlpha, ValAlphaNumeric, ValNumericString |
| Format | 6 | ValIpAddress, ValHexColor, ValBase64, ValPhoneE164, ValIban, ValColorName |
| Identity & contact | 8 | ValEmail, ValUrl, ValCreditCard, ValUsername, ValCountryCode, ValCultureCode, ValSlug, ValPostalCode (60+ countries) |
| Enum & misc | 2 | ValEnum, ValAjaxOnly |
Full attribute reference, constructor signatures, and edge-case notes are in docs/usage.md.
Quick start
using RzR.Validation.Attributes.Attributes.Require;
using RzR.Validation.Attributes.Attributes.String;
using RzR.Validation.Attributes.Attributes.Greater;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
public class CreateOrderRequest
{
[ValRequiredNotNull]
[ValRequiredNotEmpty]
public string CustomerName { get; set; }
[ValGreaterThan(0)]
public decimal Amount { get; set; }
[ValMinLength(2)]
[ValMaxLength(100)]
public string Notes { get; set; }
}
// Validate using the standard DataAnnotations API:
var model = new CreateOrderRequest { CustomerName = "Acme", Amount = 49.99m };
var results = new List<ValidationResult>();
bool isValid = Validator.TryValidateObject(model, new ValidationContext(model), results, validateAllProperties: true);
Good to know
- Custom error messages. Every attribute accepts an optional trailing
string userMessageconstructor parameter that overrides the default message. - Null is invalid by design. All non-presence attributes (comparisons, string rules, format, numeric, etc.) reject
null. Each rule is self-contained. When a field is truly optional, pair the non-presence attribute with a presence attribute only if the field is present - or handle nullability in your model before validation. - Object-level attributes require
validateAllProperties: true. The class-targeted attributes (ValAtLeastOneOf,ValMutuallyExclusive,ValExactlyOneOf,ValChronological) and the cross-property conditional attributes (ValRequiredIf,ValRequiredUnless,ValCompareProperty) only execute when you callValidator.TryValidateObject(..., validateAllProperties: true). ValAjaxOnlyis not a security control. It validates a caller-suppliedboolflag only. Real AJAX enforcement must be done server-side via an action filter or middleware that reads theX-Requested-Withheader.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard1.1 is compatible. netstandard1.2 was computed. netstandard1.3 was computed. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
| Universal Windows Platform | uap was computed. uap10.0 was computed. |
| Windows Phone | wpa81 was computed. |
| Windows Store | netcore was computed. netcore45 was computed. netcore451 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.5
- System.ComponentModel.Annotations (>= 5.0.0)
-
.NETStandard 1.1
- NETStandard.Library (>= 1.6.1)
- System.ComponentModel.Annotations (>= 5.0.0)
-
.NETStandard 2.0
- System.ComponentModel.Annotations (>= 5.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on RzR.Validation.Attributes:
| Package | Downloads |
|---|---|
|
RzR.Validation.Attributes.Mvvm
MVVM integration for RzR.Validation.Attributes. Provides a ValidatableObservableObject base class implementing INotifyPropertyChanged and INotifyDataErrorInfo that validates view-model properties with the core DataAnnotations attributes. Works with WPF, WinUI, .NET MAUI, and Avalonia — no WPF dependency. |
|
|
RzR.Validation.Attributes.AspNetCore
ASP.NET Core integration for RzR.Validation.Attributes. Automatically triggers the DataAnnotations validation attributes on Minimal API endpoints (endpoint filter via WithValidation) and MVC actions (ValidateModel / action filter), returning RFC 7807 ValidationProblemDetails (application/problem+json) responses with a configurable status code. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0.6710 | 172 | 7/18/2026 |
| 2.0.0.106 | 143 | 6/26/2026 |