-
Notifications
You must be signed in to change notification settings - Fork 5
Home
Pawel Gerr edited this page Mar 1, 2026
·
64 revisions
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).
-
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 (
Union<T1, T2, ...>) and regular inheritance-based unions, withSwitch/Mappattern matching.- Customization -- Attribute settings, backing fields, stateless types, constructors
- Framework Integration -- System.Text.Json, EF Core, MessagePack, Newtonsoft.Json
-
Object Factories -- Custom creation logic via
[ObjectFactory<T>]for advanced parsing and deserialization scenarios -
Analyzer Diagnostics -- Reference for all
TTRESGdiagnostic rules - Source Generator Configuration -- MSBuild properties for controlling generator behavior
- Empty (collections/actions/disposables)
- ToReadOnlyCollection
- TrimOrNullify (strings)
- SingleItem (collections)
- C# 11 (or higher) for generated code
- SDK 8.0.416 (or higher) for building projects
- Home
- Smart Enums
- Value Objects
- Discriminated Unions
- Object Factories
- Analyzer Diagnostics
- Source Generator Configuration
- Convenience methods and classes
- Migrations
- Version 7
- Version 8