CompositeKey 0.1.0-preview.10

This is a prerelease version of CompositeKey.
There is a newer version of this package available.
See the version list below for details.
dotnet add package CompositeKey --version 0.1.0-preview.10                
NuGet\Install-Package CompositeKey -Version 0.1.0-preview.10                
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.10" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CompositeKey --version 0.1.0-preview.10                
#r "nuget: CompositeKey, 0.1.0-preview.10"                
#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.
// Install CompositeKey as a Cake Addin
#addin nuget:?package=CompositeKey&version=0.1.0-preview.10&prerelease

// Install CompositeKey as a Cake Tool
#tool nuget:?package=CompositeKey&version=0.1.0-preview.10&prerelease                

CompositeKey

Fast and Optimized Composite Keys utilizing Source Generation

GitHub Release NuGet Downloads 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. 
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.3.0 382 10/29/2024
1.2.0 200 10/10/2024
1.1.0 5,310 9/24/2024
1.0.2-preview.3 72 9/16/2024
1.0.2-preview.2 50 9/16/2024
1.0.2-preview.1 65 9/15/2024
1.0.1 104 8/30/2024
0.1.0-preview.12 68 8/12/2024
0.1.0-preview.10 59 8/12/2024
0.1.0-preview.5 51 8/5/2024
0.1.0-preview.4 53 8/5/2024
0.1.0-preview.3 34 8/5/2024
0.1.0-preview.2 41 8/5/2024