Beskar.Memory.Code.TypeIdGenerator
1.5.5
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Beskar.Memory.Code.TypeIdGenerator --version 1.5.5
NuGet\Install-Package Beskar.Memory.Code.TypeIdGenerator -Version 1.5.5
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="Beskar.Memory.Code.TypeIdGenerator" Version="1.5.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Beskar.Memory.Code.TypeIdGenerator" Version="1.5.5" />
<PackageReference Include="Beskar.Memory.Code.TypeIdGenerator" />
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 Beskar.Memory.Code.TypeIdGenerator --version 1.5.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Beskar.Memory.Code.TypeIdGenerator, 1.5.5"
#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 Beskar.Memory.Code.TypeIdGenerator@1.5.5
#: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=Beskar.Memory.Code.TypeIdGenerator&version=1.5.5
#tool nuget:?package=Beskar.Memory.Code.TypeIdGenerator&version=1.5.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Beskar.Memory.Code.TypeIdGenerator
A high-performance C# incremental source generator that generates type-safe ID record structs (e.g., strong-typed wrappers for integers, GUIDs, and other unmanaged primitives) to prevent domain-level ID mixing bugs. The generated implementations are zero-allocation, extremely fast, and integrate with Beskar.Memory's performance primitives.
Core Component Directory
1. Attributes & Configuration
TypeSafeIdAttribute- Description: Marker attribute applied to record structs to trigger incremental code generation of strongly-typed identifiers.
- Parameters:
isOverrideString(defaulttrue): Generates custom string representation.addImplicitConversions(defaulttrue): Adds implicit operators to easily cast primitive values to their type-safe counterpart.addExplicitConversions(defaulttrue): Adds explicit operators to retrieve the underlying value.isSpanParsable(defaulttrue): Automatically implementsISpanParsable<TSelf>if the underlying type is parsable.addJsonConverter(defaulttrue): Generates a custom, high-performanceSystem.Text.Json.Serialization.JsonConverterto serialize and deserialize the ID seamlessly.
2. Interfaces & Types
ITypeSafeIdentifier<TUnderlying>- Description: The base interface implemented by all generated type-safe identifiers, exposing the underlying value.
- Key Feature: Enforces clean type safety,
IComparable, andIEquatableacross domain identifiers.
3. Serialization & Converters
TypeSafeIdJsonConverter<TId, TUnderlying>- Description: An abstract base class for JSON converters to serialize and deserialize type-safe identifiers efficiently.
- Key Feature: Prevents reflection-based JSON overhead, yielding zero heap-allocations during standard JSON reads and writes.
| Product | Versions 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.
-
net10.0
- Beskar.Memory (>= 1.5.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.