Franz.Common.AzureCosmosDB
3.0.0
dotnet add package Franz.Common.AzureCosmosDB --version 3.0.0
NuGet\Install-Package Franz.Common.AzureCosmosDB -Version 3.0.0
<PackageReference Include="Franz.Common.AzureCosmosDB" Version="3.0.0" />
<PackageVersion Include="Franz.Common.AzureCosmosDB" Version="3.0.0" />
<PackageReference Include="Franz.Common.AzureCosmosDB" />
paket add Franz.Common.AzureCosmosDB --version 3.0.0
#r "nuget: Franz.Common.AzureCosmosDB, 3.0.0"
#:package Franz.Common.AzureCosmosDB@3.0.0
#addin nuget:?package=Franz.Common.AzureCosmosDB&version=3.0.0
#tool nuget:?package=Franz.Common.AzureCosmosDB&version=3.0.0
Franz.Common.AzureCosmosDB
Azure Cosmos DB EF Core and native SDK integration for Franz persistence and messaging.
Overview
This package provides Cosmos-specific DbContext registration, EF entity repositories, native tenant-partitioned document repositories, and Cosmos-backed messaging stores. It is separate from the relational provider adapters.
Installation
dotnet add package Franz.Common.AzureCosmosDB
EF Core Cosmos context
using Franz.Common.AzureCosmosDB.Extensions;
builder.Services.AddFranzCosmosDbContext<ApplicationCosmosDbContext>(
builder.Configuration);
The extension binds the Cosmos configuration section to CosmosOptions, validates required endpoint, key, and database settings on startup by default, and configures EF Core's Cosmos provider. Setting Enabled to false skips provider configuration but does not bypass those required-option checks when validateOnStart is enabled; the native tenant repository also throws if its client is resolved while Cosmos is disabled.
For the broader EF repository/factory composition:
builder.Services.AddCosmosInfrastructure<ApplicationCosmosDbContext>(
builder.Configuration);
This composes the Cosmos context, entity repositories, GUID v7 ID generator, and entity factory registration. Entity-repository discovery inspects DbSet properties at runtime and uses reflection to close repository types; this helper is not a Native AOT registration path.
Native tenant-partitioned documents
For native Cosmos SDK documents, implement ICosmosTenantDocument and register the repository with the container name:
builder.Services.AddCosmosTenantRepository<CustomerDocument>("customers");
The target Cosmos container must use /tenantId as its partition-key path. The helper registers the concrete CosmosTenantRepository<TDocument>; resolve that concrete type or add an explicit interface mapping. The repository obtains the validated ITenantExecutionContextAccessor from the current scope and scopes operations to that tenant. This package does not create the tenant execution context; register it through the HTTP, messaging, or application-owned multi-tenancy integration used by the host. Documents use Cosmos-compatible lower-camel JSON names, including id and tenantId.
This native repository is distinct from the EF Core IEntityRepository<TEntity, TKey> registration.
Cosmos messaging stores
builder.Services.AddFranzCosmosMessaging(builder.Configuration);
This registers CosmosMessagingDbContext and the Cosmos EF implementations of IMessageStore and IInboxStore. The package owns Cosmos-specific store mapping; transport hosting remains in the relevant messaging-hosting package.
Configuration
{
"Cosmos": {
"Enabled": true,
"AccountEndpoint": "https://<account>.documents.azure.com:443/",
"AccountKey": "<secret>",
"DatabaseName": "application",
"ApplicationName": "orders-api"
}
}
Keep account keys in a secret manager. Set Enabled deliberately and validate endpoint, database, throughput, partition-key, and indexing choices against the actual deployment. The current EF and native-client setup disables TLS certificate validation when ApplicationName contains Tests; reserve that marker for isolated test configuration and never use it in production.
Tenant isolation
The EF Cosmos integration composes the framework tenant filter when multi-tenancy is enabled and the context receives a validated tenant execution accessor. Native tenant repositories use the tenant ID as the Cosmos partition key. These are distinct persistence paths; configure the matching entity/document contracts and container partition key for each.
License
MIT. See the repository LICENSE.
| 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
- Franz.Common.EntityFramework (>= 3.0.0)
- Franz.Common.Messaging (>= 3.0.0)
- Franz.Common.MultiTenancy (>= 3.0.0)
- Microsoft.Azure.Cosmos (>= 3.63.1)
- Microsoft.EntityFrameworkCore.Cosmos (>= 10.0.14)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.14)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.14)
- Newtonsoft.Json (>= 13.0.4)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Franz.Common.AzureCosmosDB:
| Package | Downloads |
|---|---|
|
Franz.Common.Http.EntityFramework
Shared utility library for the Franz Framework. |
|
|
Franz.Common.Messaging.EntityFramework
Shared utility library for the Franz Framework. |
|
|
Franz.Common.Messaging.Sagas
Shared utility library for the Franz Framework. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0 | 111 | 11/10/2026 |
| 2.3.4 | 376 | 11/1/2026 |
| 2.3.3 | 327 | 10/28/2026 |
| 2.3.2 | 138 | 10/27/2026 |
| 2.3.1 | 190 | 10/26/2026 |
| 2.3.0 | 264 | 7/21/2026 |
| 2.2.19 | 168 | 7/19/2026 |
| 2.2.18 | 162 | 7/19/2026 |
| 2.2.17 | 813 | 7/12/2026 |
| 2.2.16 | 174 | 7/2/2026 |
| 2.2.15 | 163 | 6/29/2026 |
| 2.2.14 | 163 | 6/29/2026 |
| 2.2.13 | 170 | 6/29/2026 |
| 2.2.12 | 156 | 6/28/2026 |
| 2.2.11 | 154 | 6/28/2026 |
| 2.2.10 | 173 | 6/28/2026 |
| 2.2.9 | 160 | 6/28/2026 |
| 2.2.8 | 158 | 6/28/2026 |
| 2.2.7 | 165 | 6/7/2026 |
| 2.2.6 | 164 | 6/6/2026 |