This guide details the package selection, dependencies, supported target frameworks, and minimal usage examples for all five packages in the DotNet.AutoNormalize ecosystem.
There is no metapackage. Install only the packages required for your project's architectural layer.
| Package ID | Best Used For | Key Dependencies |
|---|---|---|
AutoNormalize.Abstractions |
Shared domain libraries, contracts, models, DTOs | None (Zero external dependencies) |
AutoNormalize.Core |
Console applications, workers, backend service layers | AutoNormalize.Abstractions, Microsoft.Extensions.Options |
AutoNormalize.Json |
Standalone System.Text.Json serialization |
AutoNormalize.Core, System.Text.Json |
AutoNormalize.AspNetCore |
ASP.NET Core Minimal APIs & MVC Web APIs | AutoNormalize.Json, Microsoft.AspNetCore.App |
AutoNormalize.EntityFrameworkCore |
EF Core DbContext database persistence |
AutoNormalize.Core, Microsoft.EntityFrameworkCore |
AutoNormalize.Abstractions
dotnet add package AutoNormalize.AbstractionsContains the core interfaces (INormalizer<T>, IStringNormalizer, IAutoNormalizer), execution context (NormalizationContext), and declarative attributes ([PreserveWhitespace], [DoNotNormalize], [NormalizeWith]).
netstandard2.0net8.0net9.0
Use in shared class libraries, domain entity definitions, and contract DTO assemblies where you want to annotate models with [PreserveWhitespace] or [DoNotNormalize] without pulling in the heavy normalization engine or web dependencies.
using DotNet.AutoNormalize.Abstractions;
public class CustomerDto
{
public string Name { get; set; } = string.Empty;
[PreserveWhitespace]
public string FormattedBio { get; set; } = string.Empty;
[DoNotNormalize]
public string SecurityToken { get; set; } = string.Empty;
}AutoNormalize.Core
dotnet add package AutoNormalize.CoreThe standalone high-performance normalization engine. Provides built-in string normalizers (trimming, empty-to-null, null-to-empty, Unicode Form C/D/KC/KD, casing transforms), reflection metadata caching, and cycle-safe object graph traversal.
net8.0net9.0
AutoNormalize.AbstractionsMicrosoft.Extensions.Options
Use in background workers, console apps, message handlers, or services that need to normalize in-memory object graphs or strings directly.
using DotNet.AutoNormalize.Core;
using DotNet.AutoNormalize.Core.Engine;
var options = new AutoNormalizeOptions
{
TrimStrings = true,
EmptyStringsToNull = true
};
var normalizer = new AutoNormalizer(options);
var model = new UserProfile { DisplayName = " Ada ", Bio = " " };
normalizer.Normalize(model);
// model.DisplayName == "Ada"
// model.Bio == nullAutoNormalize.Json
dotnet add package AutoNormalize.JsonProvides System.Text.Json contract modifiers (AutoNormalizeJsonTypeInfoModifier) and property converters that intercept tokens during deserialization, enabling constructor-time normalization of C# positional records without reflection mutation.
net8.0net9.0
AutoNormalize.CoreSystem.Text.Json
Use when configuring custom JsonSerializerOptions instances in clients, microservices, or queue listeners.
using System.Text.Json;
using DotNet.AutoNormalize.Json.Extensions;
var jsonOptions = new JsonSerializerOptions().AddAutoNormalize();
string payload = """{"FullName": " Alan Turing ", "Role": " Mathematician "}""";
var person = JsonSerializer.Deserialize<PersonRecord>(payload, jsonOptions);
public record PersonRecord(string FullName, string Role);AutoNormalize.AspNetCore
dotnet add package AutoNormalize.AspNetCoreUnified ASP.NET Core integration. Automatically configures System.Text.Json for Minimal APIs and MVC controllers, registers IAutoNormalizer in dependency injection, wires MVC model binders for Query/Route/Form fields, and provides AutoNormalizeEndpointFilter.
net8.0net9.0
AutoNormalize.JsonMicrosoft.AspNetCore.App(FrameworkReference)
Use in ASP.NET Core web applications, Minimal APIs, and MVC APIs.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddAutoNormalize(options =>
{
options.TrimStrings = true;
options.EmptyStringsToNull = true;
});
var app = builder.Build();
app.MapPost("/api/users", (RegisterUserRequest request) => Results.Ok(request));
app.Run();AutoNormalize.EntityFrameworkCore
dotnet add package AutoNormalize.EntityFrameworkCoreProvides AutoNormalizeSaveChangesInterceptor and DbContextOptionsBuilder.AddAutoNormalize extensions. Automatically normalizes string properties of entities in EntityState.Added and EntityState.Modified states prior to SaveChanges(), while skipping unchanged entities.
net8.0net9.0
AutoNormalize.CoreMicrosoft.EntityFrameworkCore
Use in any project that uses Entity Framework Core to interact with relational or document databases.
using Microsoft.EntityFrameworkCore;
builder.Services.AddDbContext<AppDbContext>(options =>
{
options.UseSqlServer(connectionString)
.AddAutoNormalize();
});- .NET 8.0 & 9.0: Officially compiled, multi-targeted, and tested in CI across Windows and Linux.
- .NET 10.0 Forward Compatibility: .NET 10 applications consume the
lib/net9.0/asset via NuGet standard target framework precedence. Explicitnet10.0TFM targeting will be introduced when .NET 10 reaches General Availability.