Skip to content

Access to CosmosClient creation #398

Closed
@joelsteventurner

Description

@joelsteventurner

I've been using this framework and am generally very happy with it, but I have run into a couple scenarios where the framework makes it difficult to do certain things. These issues all seem to stem from the fact that the CosmosClient instantiation is inaccessible.

The 2 scenarios that are proving problematic to me are as follows:

  1. Multi-tenancy, where I have a single application and each tenant has their own Cosmos instance

In this scenario I'd ideally want a cached CosmosClient per tenant, but the framework has a singleton CosmosClient and the factory interface for this ICosmosClientProvider is internal so I see no way to easily extend this.

  1. Automated Integration testing against a dockerized cosmos emulator

Here I am using Microsoft.AspNetCore.Mvc.Testing along with Testcontainers.CosmosDb to write automated integration tests. In this scenario I need to as part of the tests reconfigure my application, see example below. Here you can see the need for CosmosClient re-configuration / customization.

image

The feature I'd like to simply making the ICosmosClientProvider interface public so that custom implementations can be supplied.
Or more generally make it such that there is a factory which creates the CosmosClient, which can have its implementation swapped out.

This would allow me to create a MultiTenantCosmosClientProvider and an IntegrationCosmosClientProvider which I beleive would solve these issues.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions