Soenneker.Cosmos.Repositories.Shared 4.0.474

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Cosmos.Repositories.Shared --version 4.0.474
                    
NuGet\Install-Package Soenneker.Cosmos.Repositories.Shared -Version 4.0.474
                    
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="Soenneker.Cosmos.Repositories.Shared" Version="4.0.474" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Cosmos.Repositories.Shared" Version="4.0.474" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Cosmos.Repositories.Shared" />
                    
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 Soenneker.Cosmos.Repositories.Shared --version 4.0.474
                    
#r "nuget: Soenneker.Cosmos.Repositories.Shared, 4.0.474"
                    
#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 Soenneker.Cosmos.Repositories.Shared@4.0.474
                    
#: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=Soenneker.Cosmos.Repositories.Shared&version=4.0.474
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Cosmos.Repositories.Shared&version=4.0.474
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Cosmos.Repositories.Shared

An abstract Cosmos repository base for isolating one typed-document model inside a container shared by several models.

Installation

dotnet add package Soenneker.Cosmos.Repositories.Shared

Define a repository

Derive from SharedRepository<TDocument>, where the document extends TypedDocument. Each derived repository must choose both its container and the EntityType discriminator stored on its documents.

public interface IProductRepository : ISharedRepository<ProductDocument>
{
}

public sealed class ProductRepository : SharedRepository<ProductDocument>, IProductRepository
{
    public override string ContainerName => "catalog";
    protected override string EntityType => "product";

    public ProductRepository(
        ICosmosContainerUtil containerUtil,
        IConfiguration configuration,
        ILogger<SharedRepository<ProductDocument>> logger,
        IUserContext userContext,
        IBackgroundQueue backgroundQueue,
        IMemoryStreamUtil memoryStreamUtil)
        : base(containerUtil, configuration, logger, userContext, backgroundQueue, memoryStreamUtil)
    {
    }
}

Register the concrete repository as scoped because it consumes scoped user context:

services.AddScoped<IProductRepository, ProductRepository>();

This package has no registrar. Register the Cosmos container, user context, background queue, memory-stream utility, configuration, and logging dependencies required by the base constructor.

Discriminator-scoped operations

The following operations automatically add an EntityType filter:

  • GetAll and GetAllIds
  • Any, None, and Count
  • DeleteAll, DeleteAllPaged, and DeleteAllPagedParallel

Other inherited methods follow the ICosmosRepository<TDocument> contract and use the IDs, partition keys, or queries supplied by the caller. They do not automatically prevent access to another discriminator. Use unique, stable discriminator values and avoid exposing an unrestricted repository to untrusted callers.

DeleteAll first loads all matching IDs. DeleteAllPaged processes ordered pages sequentially and can queue deletes. DeleteAllPagedParallel performs direct deletes with bounded concurrency and requires maxConcurrency of at least 1.

Bulk deletion is permanent and not transactional across the result set. A failure or cancellation propagates after already completed or queued work; it does not roll that work back.

Product 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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.Cosmos.Repositories.Shared:

Package Downloads
Soenneker.Cosmos.Repositories.General

A data persistence abstraction layer for Cosmos DB General type documents

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.493 87 10/1/2026
4.0.492 54 10/1/2026
4.0.491 72 10/1/2026
4.0.490 61 9/30/2026
4.0.489 56 9/30/2026
4.0.488 49 9/30/2026
4.0.487 57 9/30/2026
4.0.486 55 9/30/2026
4.0.485 58 9/30/2026
4.0.484 70 9/30/2026
4.0.483 62 9/30/2026
4.0.482 60 9/30/2026
4.0.481 45 9/30/2026
4.0.479 71 9/30/2026
4.0.478 61 9/30/2026
4.0.477 62 9/30/2026
4.0.476 105 9/29/2026
4.0.475 94 9/29/2026
4.0.474 98 9/28/2026
4.0.473 107 9/27/2026
Loading failed

Merge pull request #690 from soenneker/renovate/soenneker.cosmos.repository-4.x

Update dependency Soenneker.Cosmos.Repository to 4.0.8357