Soenneker.Cosmos.Repositories.General
4.0.681
Prefix Reserved
dotnet add package Soenneker.Cosmos.Repositories.General --version 4.0.681
NuGet\Install-Package Soenneker.Cosmos.Repositories.General -Version 4.0.681
<PackageReference Include="Soenneker.Cosmos.Repositories.General" Version="4.0.681" />
<PackageVersion Include="Soenneker.Cosmos.Repositories.General" Version="4.0.681" />
<PackageReference Include="Soenneker.Cosmos.Repositories.General" />
paket add Soenneker.Cosmos.Repositories.General --version 4.0.681
#r "nuget: Soenneker.Cosmos.Repositories.General, 4.0.681"
#:package Soenneker.Cosmos.Repositories.General@4.0.681
#addin nuget:?package=Soenneker.Cosmos.Repositories.General&version=4.0.681
#tool nuget:?package=Soenneker.Cosmos.Repositories.General&version=4.0.681
Soenneker.Cosmos.Repositories.General
An abstract Cosmos repository base for multiple typed-document models stored in the shared general container.
Installation
dotnet add package Soenneker.Cosmos.Repositories.General
Define a repository
The package does not register a concrete service. Derive from GeneralRepository<TDocument>, where the document extends TypedDocument, and provide the discriminator stored in its EntityType property.
public interface IWidgetRepository : IGeneralRepository<WidgetDocument>
{
}
public sealed class WidgetRepository : GeneralRepository<WidgetDocument>, IWidgetRepository
{
protected override string EntityType => "widget";
public WidgetRepository(
ICosmosContainerUtil containerUtil,
IConfiguration configuration,
ILogger<GeneralRepository<WidgetDocument>> logger,
IUserContext userContext,
IBackgroundQueue backgroundQueue,
IMemoryStreamUtil memoryStreamUtil)
: base(containerUtil, configuration, logger, userContext, backgroundQueue, memoryStreamUtil)
{
}
}
Register your implementation as scoped because the repository consumes scoped user context:
services.AddScoped<IWidgetRepository, WidgetRepository>();
The Cosmos container, user context, background queue, memory-stream utility, configuration, and logging dependencies must also be registered. This package deliberately does not choose their lifetimes for the application.
Behavior
All derived repositories use the general container. GetAll, GetAllIds, DeleteAll, DeleteAllPaged, and DeleteAllPagedParallel limit their work to documents whose EntityType equals the derived repository's discriminator. The rest of the inherited ICosmosRepository<TDocument> API provides point reads, queries, writes, conditional ETag operations, paging, and audit support.
Documents must use the partition-key shape expected by Soenneker.Cosmos.Repository and the configured container. Choose stable, unique EntityType values; two repository types using the same value operate on the same documents.
Delete-all operations are permanent and are not transactional across the full result set. Failures and cancellation propagate after any already completed deletes.
| 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.Repositories.Shared (>= 4.0.405)
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 |
|---|---|---|
| 4.0.681 | 0 | 9/1/2026 |
| 4.0.680 | 0 | 9/1/2026 |
| 4.0.679 | 26 | 9/1/2026 |
| 4.0.678 | 26 | 9/1/2026 |
| 4.0.677 | 28 | 9/1/2026 |
| 4.0.676 | 39 | 8/31/2026 |
| 4.0.675 | 47 | 8/31/2026 |
| 4.0.674 | 45 | 8/31/2026 |
| 4.0.673 | 58 | 8/31/2026 |
| 4.0.672 | 57 | 8/30/2026 |
| 4.0.671 | 48 | 8/30/2026 |
| 4.0.670 | 45 | 8/30/2026 |
| 4.0.669 | 46 | 8/29/2026 |
| 4.0.668 | 47 | 8/29/2026 |
| 4.0.667 | 79 | 8/27/2026 |
| 4.0.666 | 93 | 8/26/2026 |
| 4.0.665 | 76 | 8/26/2026 |
| 4.0.664 | 80 | 8/26/2026 |
| 4.0.663 | 97 | 8/22/2026 |
| 4.0.662 | 88 | 8/22/2026 |
Updated NuGet packages