Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EF Core provider gap: Provide proper synchronous version of various APIs #31

Open
divega opened this issue Jan 26, 2019 · 5 comments
Open
Assignees
Labels
discussion-wanted Need a discussion on an area feature-request New feature or request

Comments

@divega
Copy link

divega commented Jan 26, 2019

The following methods don't have synchronous equivalents:

  • CreateDatabaseIfNotExistsAsync()
  • CosmosDatabase.DeleteAsync()
  • CreateContainerIfNotExistsAsync()
  • CosmosResultSetIterator<>.FetchNextSetAsync()
  • CosmosQueryResponse<>.FetchNextSetAsync()
  • CreateItemAsync<>()
  • ReplaceItemAsync<>()
  • DeleteItemAsync<>()

Since EF Core provides both synchronous and asynchronous APIs, in the EF Core provider implementation we need to choose between throwing NotSupportedException and applying workarounds that can cause threads to block and deadlocks.

This issue existed in previous versions of the SDK, and still applies to Cosmos SDK version 3.0.0.1-preview.

cc @AndriySvyryd @ajcvickers @kirillg

@kirankumarkolli kirankumarkolli added the discussion-wanted Need a discussion on an area label Jan 30, 2019
@kirankumarkolli kirankumarkolli self-assigned this Jan 30, 2019
@kirankumarkolli
Copy link
Member

Can you please more on how only async blocks/dead-locks but sync works?

@AndriySvyryd
Copy link

@kirankulkarni747 Calling an async method from a sync method requires some kind of blocking (like Task.Wait()) this goes against best practices as it can cause deadlocks. Using ConfigureAwait(false) to avoid deadlocks is brittle and can't be relied on.

@AndriySvyryd
Copy link

@jackbond For local databases and scenarios without strict memory constraints synchronous methods are usually more performant.

@kirankumarkolli kirankumarkolli added the feature-request New feature or request label Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion-wanted Need a discussion on an area feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants
@divega @AndriySvyryd @kirankumarkolli and others