microsoft / microsoft/aspire

Add support for custom configuration for CosmosDB

Open
#9,143 3 comments 5 reactions 0 assignees View on GitHub
area-integrations azure azure-cosmosdb
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

I am trying to add Aspire to an existing project which requires composite indexes.

After several tentative, with custom commands, snapshot (via initial state) or trying directly to use the builder's required services, I just went with the code in base project way.
However in terms of design and separation of concerns, I'm not very happy with modifying the structure of my CosmosDB containers after their creation and at run time of my application.

### Describe the solution you'd like

I noticed a discussion here https://github.com/dotnet/aspire/discussions/8438 where it was suggested to add container options to pass along custom configuration. It seems like a good suggestion.

Another way could be to modify the API offering methods to add the values needed.
In my case for example it could look like:

```C#
var container = cosmosDbDatabase.AddContainer("container", "/partitionKey");
container.AddIndexingPolicy(new CompositePath() { Path = "/path/path", Order = CompositePathSortOrder.Descending });
```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.