GithubHelp home page GithubHelp logo

Comments (4)

j82w avatar j82w commented on June 15, 2024

Hi Diego,

In the v2 implementation it was required to pass the client and database name, and container name to generate the URL to do a call to Cosmos DB. With this new implementation we removed the need to generate URLs, and allowed the ability to do dependency injection. With the new implementation you can simply pass the CosmosContainer object everywhere. It's recommended to cache the object to avoid the additional load to create it. The application should only check if the database and container exists on the initial application startup, and there should only be one CosmosClient to prevent performance issues. The code is here if you want to see how it is implemented.

CosmosContainer container = this.cosmosClient.Databases["myDb"].Containers["myContainer"];

If this does not fix your issue can you please provide some samples?

from azure-cosmos-dotnet-v3.

AndriySvyryd avatar AndriySvyryd commented on June 15, 2024

@j82w That does enable our scenario, though this API has low discoverability.

from azure-cosmos-dotnet-v3.

j82w avatar j82w commented on June 15, 2024

We can increase the documentation around this scenario, and add more samples to prevent this in the future.
@kirankumarkolli and @kirillg do you think it might be worth adding methods like GetDatabase to increase exposure on how to get the objects other than the index overload?

from azure-cosmos-dotnet-v3.

j82w avatar j82w commented on June 15, 2024

@AndriySvyryd we are changing the API to make it easier to discover. I'm closing this issue please look at #333

from azure-cosmos-dotnet-v3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.