Soenneker.Cosmos.Repositories.Shared
11.0.528
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Cosmos.Repositories.Shared --version 11.0.528
NuGet\Install-Package Soenneker.Cosmos.Repositories.Shared -Version 11.0.528
<PackageReference Include="Soenneker.Cosmos.Repositories.Shared" Version="11.0.528" />
<PackageVersion Include="Soenneker.Cosmos.Repositories.Shared" Version="11.0.528" />
<PackageReference Include="Soenneker.Cosmos.Repositories.Shared" />
paket add Soenneker.Cosmos.Repositories.Shared --version 11.0.528
#r "nuget: Soenneker.Cosmos.Repositories.Shared, 11.0.528"
#:package Soenneker.Cosmos.Repositories.Shared@11.0.528
#addin nuget:?package=Soenneker.Cosmos.Repositories.Shared&version=11.0.528
#tool nuget:?package=Soenneker.Cosmos.Repositories.Shared&version=11.0.528
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:
GetAllandGetAllIdsAny,None, andCountDeleteAll,DeleteAllPaged, andDeleteAllPagedParallel
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Cosmos.Repository (>= 11.0.8455)
- Soenneker.Documents.Typed (>= 11.0.162)
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 |
|---|---|---|
| 11.0.535 | 0 | 10/27/2026 |
| 11.0.534 | 0 | 10/27/2026 |
| 11.0.533 | 0 | 10/27/2026 |
| 11.0.532 | 0 | 10/27/2026 |
| 11.0.531 | 0 | 10/26/2026 |
| 11.0.528 | 0 | 10/26/2026 |
| 11.0.527 | 0 | 10/26/2026 |
| 11.0.526 | 0 | 10/26/2026 |
| 11.0.525 | 35 | 10/26/2026 |
| 4.0.524 | 248 | 10/15/2026 |
| 4.0.523 | 173 | 10/15/2026 |
| 4.0.522 | 120 | 10/15/2026 |
| 4.0.521 | 86 | 10/15/2026 |
| 4.0.520 | 90 | 10/15/2026 |
| 4.0.518 | 105 | 10/14/2026 |
| 4.0.515 | 120 | 10/14/2026 |
| 4.0.514 | 95 | 10/14/2026 |
| 4.0.509 | 103 | 10/13/2026 |
| 4.0.508 | 87 | 10/13/2026 |
| 4.0.507 | 105 | 10/12/2026 |
Updated Soenneker.Cosmos.Repository to 11.0.8455