GithubHelp home page GithubHelp logo

EF Core provider gap: No way to know if CreateContainerIfNotExistsAsync actually created the container about azure-cosmos-dotnet-v3 HOT 4 CLOSED

azure avatar azure commented on June 15, 2024
EF Core provider gap: No way to know if CreateContainerIfNotExistsAsync actually created the container

from azure-cosmos-dotnet-v3.

Comments (4)

divega avatar divega commented on June 15, 2024

It turns out that it is possible to obtain the information of whether the database was created from the status property on the response object, but the API seems to be quite complex.

from azure-cosmos-dotnet-v3.

j82w avatar j82w commented on June 15, 2024

Hi Deigo,

All of the Async method with throw an exception if it get's an error while creating the container. The exception to this rule is Cosmos Item Stream APIs which only return the status. This is for performance reasons. Also to note that not found is not an exception. This is considered as part of a normal workflow, and will return null for the resource.

The responses are documented here.

from azure-cosmos-dotnet-v3.

divega avatar divega commented on June 15, 2024

@j82w the issue was about being able to more easily distinguish between two different conditions when a call to CreateContainerIfNotExistsAsync succeeds:

  • The container already exists and didn’t need to be created
  • The container did not exist and was successfully created

I will let @AndriySvyryd comment if he still thinks there is an API usability or discoverability problem worth addressing.

from azure-cosmos-dotnet-v3.

j82w avatar j82w commented on June 15, 2024

@divega if that is the case you can do the read yourself, and if it is null do the create.

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.