CompositeKey 0.1.0-preview.4

This is a prerelease version of CompositeKey.
There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package CompositeKey --version 0.1.0-preview.4
                    
NuGet\Install-Package CompositeKey -Version 0.1.0-preview.4
                    
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="CompositeKey" Version="0.1.0-preview.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CompositeKey" Version="0.1.0-preview.4" />
                    
Directory.Packages.props
<PackageReference Include="CompositeKey" />
                    
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 CompositeKey --version 0.1.0-preview.4
                    
#r "nuget: CompositeKey, 0.1.0-preview.4"
                    
#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.
#addin nuget:?package=CompositeKey&version=0.1.0-preview.4&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CompositeKey&version=0.1.0-preview.4&prerelease
                    
Install as a Cake Tool

CompositeKey

Fast and Optimized Composite Keys utilizing Source Generation

GitHub Release Build Status


What is CompositeKey

CompositeKey is a library for source generating optimal parsing and formatting code for composite identifiers in dotnet.

Implementing concepts widely used in NoSQL databases, such as Amazon DynamoDb, a composite key is where multiple discrete keys are combined to form a more complex structure for use as the primary key of an item in the data.

// They can be simple
[CompositeKey("{PartitionKey}#{SortKey:N}")]
public sealed partial record PrimaryKey(Guid PartitionKey, Guid SortKey);

Console.WriteLine(PrimaryKey.Parse($"{Guid.NewGuid()}#{Guid.NewGuid():N}"));

// Or they can be more complex
[CompositeKey("{PartitionKey}|{AnyParsableValue:0.00}#ConstantValueAsPartOfKey@{FirstPartOfSortKey}~{SecondPartOfSortKey}", PrimaryKeySeparator = '#')]
public sealed partial record ComplexKey(string PartitionKey, SomeEnum FirstPartOfSortKey, Guid SecondPartOfSortKey)
{
    public required int AnyParsableValue { get; init; }
}

var complexKey = new ComplexKey(Guid.NewGuid().ToString(), SomeEnum.Value, Guid.NewGuid()) { AnyParsableValue = 123 };
Console.WriteLine(complexKey.ToString());
Console.WriteLine(complexKey.ToPartitionKeyString());
Console.WriteLine(complexKey.ToSortKeyString());
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net8.0

    • No dependencies.

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
1.4.0 87 7/4/2025
1.3.1 5,160 5/23/2025
1.3.0 24,504 10/29/2024
1.2.0 260 10/10/2024
1.1.0 8,639 9/24/2024
1.0.1 126 8/30/2024