CompositeKey 0.1.0-preview.2
This is a prerelease version of CompositeKey.
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 CompositeKey --version 0.1.0-preview.2
NuGet\Install-Package CompositeKey -Version 0.1.0-preview.2
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.2" />
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.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CompositeKey, 0.1.0-preview.2"
#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.2&prerelease // Install CompositeKey as a Cake Tool #tool nuget:?package=CompositeKey&version=0.1.0-preview.2&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CompositeKey
Fast and Optimized Composite Keys utilizing Source Generation
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 | Versions 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 | 5,066 | 10/29/2024 |
1.2.0 | 217 | 10/10/2024 |
1.1.0 | 8,311 | 9/24/2024 |
1.0.2-preview.3 | 77 | 9/16/2024 |
1.0.2-preview.2 | 53 | 9/16/2024 |
1.0.2-preview.1 | 70 | 9/15/2024 |
1.0.1 | 111 | 8/30/2024 |
0.1.0-preview.12 | 71 | 8/12/2024 |
0.1.0-preview.10 | 64 | 8/12/2024 |
0.1.0-preview.5 | 56 | 8/5/2024 |
0.1.0-preview.4 | 56 | 8/5/2024 |
0.1.0-preview.3 | 39 | 8/5/2024 |
0.1.0-preview.2 | 44 | 8/5/2024 |