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

Cosmos DB: Issues with surrogate PK design in preview 3 #13633

Closed
divega opened this issue Oct 15, 2018 · 1 comment
Closed

Cosmos DB: Issues with surrogate PK design in preview 3 #13633

divega opened this issue Oct 15, 2018 · 1 comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@divega
Copy link
Contributor

divega commented Oct 15, 2018

I haven't fully tested that this is an issue but I wanted to capture it before I forget:

  • With the current design we do not guarantee uniqueness of "real" key values across multiple instances of DbContext. E.g. you can save a customer with a CustomerId = 1 even if one already exists in the database
  • Disconnected scenarios (for example, using Attach) do not populate the surrogate key in shadow state, and therefore it wouldn't be possible to update or delete an existing entity without additional roundrips

@smitpatel and I discussed briefly that a design that creates the value for id deterministically based on actual values on properties could address this, but such design may have other problems.

Note that if we want entity hierarchies to share key space, we should use the discriminator value of the base type when we construct the id.

@divega
Copy link
Contributor Author

divega commented Oct 15, 2018

cc @AndriySvyryd

@ajcvickers ajcvickers added this to the 3.0.0 milestone Oct 17, 2018
@smitpatel smitpatel mentioned this issue Oct 17, 2018
82 tasks
@AndriySvyryd AndriySvyryd removed their assignment Jan 16, 2019
@AndriySvyryd AndriySvyryd added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jan 16, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview2 Feb 6, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0-preview2, 3.0.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

No branches or pull requests

3 participants