Conform.Net.Annotations 0.1.0-preview.1

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

Conform.Net

Validate and normalize .NET object graphs in one pass. Conform checks nested objects and collections against declarative contracts. Every problem is reported with an exact path (Lines[3].Barcode), and you get each value's canonical form as a proposed change. Nothing is written to your objects until you call Apply().

  • Validation + normalization in one contract; rules judge the normalized value
  • Pure evaluation, plus an explicit, conflict-checked Apply()
  • Nested objects, collections, List<List<T>>, cycles and shared references
  • Structured findings: path, code, severity, expected, observed
  • Works with the DataAnnotations attributes you already use (Conform.Net.Annotations)
  • Zero-dependency, AOT-compatible core
using Conform;

var registry = new ContractRegistry()
    .Define<Order>(c =>
    {
        c.Member(o => o.Phone).Required()
            .Normalize(Normalizers.DigitsOnly, Normalizers.KeepLast(10))  // "+90 (532) 123 45 67" → "5321234567"
            .Matches(@"^5\d{9}$");
        c.Member(o => o.Lines).Required().Count(min: 1).Descend();
    });

var report = new ConformanceEngine(registry).Evaluate(order);   // pure
if (report.IsConformant) report.Apply();                           // commit canonical values
else return Results.ValidationProblem(report.ToErrorDictionary());

With attributes (Conform.Net.Annotations):

var registry = new ContractRegistry().UseAnnotations();

public class Customer
{
    [Required, Trim, StringLength(60, MinimumLength = 2)] public string? Name { get; set; }
    [Required, DigitsOnly(Order = 1), KeepLast(10, Order = 2)] public string? Phone { get; set; }
    [Required, MinLength(1), Descend] public List<Address>? Addresses { get; set; }
}

📖 Documentation, comparison with FluentValidation/DataAnnotations, and benchmarks: https://github.com/Murat7Ay/AttributeBasedValidation

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.1.0-preview.1 87 9/30/2026