NationalIdentifiers.AspNetCore 1.0.2

dotnet add package NationalIdentifiers.AspNetCore --version 1.0.2
                    
NuGet\Install-Package NationalIdentifiers.AspNetCore -Version 1.0.2
                    
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="NationalIdentifiers.AspNetCore" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NationalIdentifiers.AspNetCore" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="NationalIdentifiers.AspNetCore" />
                    
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 NationalIdentifiers.AspNetCore --version 1.0.2
                    
#r "nuget: NationalIdentifiers.AspNetCore, 1.0.2"
                    
#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 NationalIdentifiers.AspNetCore@1.0.2
                    
#: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=NationalIdentifiers.AspNetCore&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=NationalIdentifiers.AspNetCore&version=1.0.2
                    
Install as a Cake Tool

NationalIdentifiers.AspNetCore

ASP.NET Core integration for NationalIdentifiers.Core: validation of national tax identifiers for 195 countries in web APIs. It also supports the same 7 separately tracked ISO territories as NationalIdentifiers.Core. Targets .NET 8 and .NET 10.

Coverage depth and the offline trust boundary are documented in docs/COVERAGE-DEPTH.md and docs/TRUST-MODEL.md. Copy-paste Minimal API, MVC and service-layer examples are available in docs/RECIPES.md.

Setup

builder.Services.AddNationalIdentifiers();

Validation attribute

public sealed record RegisterRequest(
    string Country,
    [ValidTaxId(nameof(Country))] string TaxId);

The attribute validates the tax ID against the rules of the country named by the companion property, so a single field can hold an Italian Codice Fiscale, a Partita IVA or any foreign TIN depending on the user.

[ValidTaxId] skips null, empty and whitespace-only values, leaving required field checks to [Required] and matching the Angular validator's behavior. It also returns a structured failure message rather than throwing, which is compatible with ASP.NET Core ModelState and problem-detail payloads.

The default policy mode rejects only definitive failures. Use strict mode when every failed local check must block the request:

[ValidTaxId(nameof(Country), Mode = TaxIdValidationMode.Strict)]
public string? TaxId { get; init; }

Action filter

TaxIdValidationFilter validates incoming requests centrally and produces RFC 7807 problem details for failures.

Policy decisions

Combine with TaxIdPolicy.Evaluate from the core package to map results to accept/warn/block decisions — block on failed check digits, warn (store and flag) for countries with format-only rules instead of rejecting users.

For one-off validation outside MVC filters or attributes, use the core package static API: TaxIdValidator.Validate(...). Resolve ITaxIdValidator from dependency injection when you want the same behavior behind an application service or endpoint filter.

This package now shares the same policy semantics as the JS helper taxIdCheckOutcome, making warning and blocking behavior consistent between backend and frontend validation.

SemVer and API stability rules are documented in docs/API-STABILITY.md.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 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.2 153 6/16/2026
1.0.1 123 6/16/2026
1.0.0 135 6/15/2026
0.2.0 120 6/13/2026
0.1.0 137 6/12/2026