IEvangelist / azure-cosmos-dotnet-repository

Wraps the .NET SDK for Azure Cosmos DB abstracting away the complexity, exposing a simple CRUD-based repository pattern
https://ievangelist.github.io/azure-cosmos-dotnet-repository
MIT License
311 stars 92 forks source link

Allow for read/write client separation #324

Open dnitsch opened 1 year ago

dnitsch commented 1 year ago

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

Related to this discussion

Describe the solution you'd like

The caller should be allowed to pass in a read and/or write endpoints. If omitted the default account endpoint to be used for operations of both types.

If writeEndpoint is supplied the underlying write operations i.e. all methods in the IWriteRepository and IBatchRepository should use it, similarly for the reads.

This might require storing 2 versions of the client on the struct as a private properties... 🤷‍♂️

Describe alternatives you've considered Implementation still needs ironing out

Additional context

Currently scenarios requiring multi region setup with strong consistency cannot be properly satisfied, where writes should only occur into a single region.

IEvangelist commented 1 year ago

@all-contributors please add @dnitsch for idea

allcontributors[bot] commented 1 year ago

@IEvangelist

I've put up a pull request to add @dnitsch! :tada:

mumby0168 commented 1 year ago

@dnitsch I know we had a chat about this and you had found that this wasn't required due to the SDK knowing which endpoints to hit in which scenarios under the hood. Are you able to provide the detail you gave to me on this issue?

dnitsch commented 1 year ago

Hey @mumby0168 - sorry about the delay. I'll update the discussion issue today.

mumby0168 commented 1 year ago

Hi @dnitsch were you okay to update this issue with your findings?

Thanks.

dnitsch commented 1 year ago

@mumby0168 - ended up updating the discussion issue instead.

Now, need to find the time to submit the idea/suggestion.