Soenneker.Cosmos.Repositories.Shared
4.0.394
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Cosmos.Repositories.Shared --version 4.0.394
NuGet\Install-Package Soenneker.Cosmos.Repositories.Shared -Version 4.0.394
<PackageReference Include="Soenneker.Cosmos.Repositories.Shared" Version="4.0.394" />
<PackageVersion Include="Soenneker.Cosmos.Repositories.Shared" Version="4.0.394" />
<PackageReference Include="Soenneker.Cosmos.Repositories.Shared" />
paket add Soenneker.Cosmos.Repositories.Shared --version 4.0.394
#r "nuget: Soenneker.Cosmos.Repositories.Shared, 4.0.394"
#:package Soenneker.Cosmos.Repositories.Shared@4.0.394
#addin nuget:?package=Soenneker.Cosmos.Repositories.Shared&version=4.0.394
#tool nuget:?package=Soenneker.Cosmos.Repositories.Shared&version=4.0.394
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 | 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. |
-
net10.0
- Soenneker.Cosmos.Repository (>= 4.0.8145)
- Soenneker.Documents.Typed (>= 4.0.108)
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.396 | 0 | 8/30/2026 |
| 4.0.395 | 0 | 8/30/2026 |
| 4.0.394 | 33 | 8/30/2026 |
| 4.0.393 | 34 | 8/29/2026 |
| 4.0.392 | 35 | 8/29/2026 |
| 4.0.391 | 78 | 8/27/2026 |
| 4.0.390 | 67 | 8/26/2026 |
| 4.0.389 | 55 | 8/26/2026 |
| 4.0.388 | 51 | 8/26/2026 |
| 4.0.387 | 43 | 8/26/2026 |
| 4.0.385 | 114 | 8/22/2026 |
| 4.0.384 | 106 | 8/22/2026 |
| 4.0.383 | 104 | 8/22/2026 |
| 4.0.382 | 90 | 8/22/2026 |
| 4.0.381 | 163 | 8/21/2026 |
| 4.0.380 | 104 | 8/21/2026 |
| 4.0.379 | 197 | 8/20/2026 |
| 4.0.378 | 106 | 8/19/2026 |
| 4.0.377 | 114 | 8/18/2026 |
| 4.0.376 | 108 | 8/18/2026 |
Isolate shared repository operations by type