Allegro.CosmosDb.ConsistencyLevelUtilities 1.0.0 The ID prefix of this package has been reserved for one of the owners of this package by Prefix Reserved

.NET 5.0
Install-Package Allegro.CosmosDb.ConsistencyLevelUtilities -Version 1.0.0
dotnet add package Allegro.CosmosDb.ConsistencyLevelUtilities --version 1.0.0
<PackageReference Include="Allegro.CosmosDb.ConsistencyLevelUtilities" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Allegro.CosmosDb.ConsistencyLevelUtilities --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Allegro.CosmosDb.ConsistencyLevelUtilities, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Allegro.CosmosDb.ConsistencyLevelUtilities as a Cake Addin
#addin nuget:?package=Allegro.CosmosDb.ConsistencyLevelUtilities&version=1.0.0

// Install Allegro.CosmosDb.ConsistencyLevelUtilities as a Cake Tool
#tool nuget:?package=Allegro.CosmosDb.ConsistencyLevelUtilities&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


This library contains utilities helpful in handling CosmosDb Consistency Levels.


CosmosDb database has always some consistency level set (by default it's the Session Level - see more details here). This attribute should be used alongside ContainerExtensions.ReadItemWithCustomConsistencyAsync method to mark entities that can use a relaxed consistency settings to optimize RU cost or read latency.
To prevent cold start issues, please invoke ContainerExtensions.WarmUp() method in your program's entrypoint.\


Usage example can be found in the Allegro.CosmosDb.Demo project.

Entity definition:

public class CosmosDocument
    // some properties

Reading the entity with lowered consistency:

using Allegro.CosmosDb.ConsistencyLevelUtilities;

// ...
var item = await container.ReadItemWithCustomConsistencyAsync<CosmosDocument>(
    new PartitionKey(documentId),
    cancellationToken: HttpContext.RequestAborted);


More info

More information about overriding database's consistency levels can be found here.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

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.0.0 78 3/4/2022