Skip to content
Pawel Gerr edited this page Dec 1, 2026 · 71 revisions

Build TestResults NuGet Downloads

Thinktecture.Runtime.Extensions
Thinktecture.Runtime.Extensions.EntityFrameworkCore9
Thinktecture.Runtime.Extensions.EntityFrameworkCore10
Thinktecture.Runtime.Extensions.EntityFrameworkCore11
Thinktecture.Runtime.Extensions.Json
Thinktecture.Runtime.Extensions.Newtonsoft.Json
Thinktecture.Runtime.Extensions.MessagePack
Thinktecture.Runtime.Extensions.Serilog
Thinktecture.Runtime.Extensions.AspNetCore
Thinktecture.Runtime.Extensions.Swashbuckle

This library uses Roslyn Source Generators, Analyzers, CodeFixes, and Refactorings to provide Smart Enums (type-safe alternatives to enum), Value Objects (immutable domain primitives with built-in validation), and Discriminated Unions (type-safe "one of" types).

Core Concepts

  • Smart Enums -- Type-safe enumerations with behavior, supporting keyed (with an underlying value) and keyless variants.

    • Customization -- Attribute settings, equality, comparison, parsable interfaces, and more
    • Framework Integration -- System.Text.Json, EF Core, ASP.NET Core, MessagePack, Newtonsoft.Json
    • Performance -- Span-based JSON, zero-allocation parsing, benchmarks
  • Value Objects -- Immutable domain primitives (simple single-value or complex multi-property) with built-in validation and factory methods.

    • Customization -- Attribute settings, equality comparers, factory methods, operators
    • Framework Integration -- System.Text.Json, EF Core, ASP.NET Core, MessagePack, Newtonsoft.Json
  • Discriminated Unions -- Type-safe unions including ad-hoc unions (AdHocUnion<T1, T2, ...>) and regular inheritance-based unions, with Switch/Map pattern matching.

Supporting Topics

  • Object Factories -- Custom creation logic via [ObjectFactory<T>] for advanced parsing and deserialization scenarios
  • Serilog Integration -- Serilog destructuring for Smart Enums, Value Objects, and ad-hoc unions
  • Analyzer Diagnostics -- Reference for all TTRESG diagnostic rules
  • Source Generator Configuration -- MSBuild properties for controlling generator behavior, and what other source generators in the same project see
  • AI Coding Assistants -- the agent skill (npx skills or Claude Code plugin) and Context7 (MCP) support for Claude Code, Cursor, and other AI coding agents

Convenience Methods and Classes

Requirements

  • C# 13 (or higher) for generated code
  • .NET 10 SDK (or higher) for building projects
  • Target framework net9.0 (or higher)

Migrations

Clone this wiki locally