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] Translate __jObject to Access Root #22143

Merged
merged 6 commits into from
Aug 22, 2020

Conversation

TheFanatr
Copy link
Contributor

@TheFanatr TheFanatr commented Aug 20, 2020

This PR makes it so that the EFCore CosmosDB provider translates the __jObject property on all entities even though it is non-persisted, in order to allow await someContext.ReloadAsync() to not throw. This is discussed in #18710.

In order to allow the __jObject property to have an updated value after reload, KeyAccessExpression was changed so that it translates to AccessExpression instead of AccessExpression[Name] if Name is null or of size 0, so that the translated __jObject property value in the JSON is given the document as it's value. This will only cause problems if there are other cases where non-persisted properties need to be translated to c[""], which wouldn't be the case even with #17670 fixed.

Fixes #18710

@AndriySvyryd
Copy link
Member

@TheFanatr You need to add at least one test the fails without this change

@TheFanatr
Copy link
Contributor Author

@AndriySvyryd Done.

@TheFanatr
Copy link
Contributor Author

TheFanatr commented Aug 21, 2020

Is there a reason the tests are failing on efcore-ci checks? Does it matter that I don't use a TestFixture? The code I use is effectively what the others do.

@AndriySvyryd
Copy link
Member

It's failing because it's not using ConditionalTheory, so the test runs even if there's no Cosmos emulator available.

… is provided, and update ReloadTest to verify that __jObject is updated after reloads.
@AndriySvyryd AndriySvyryd self-assigned this Aug 21, 2020
TheFanatr and others added 2 commits August 21, 2020 15:57
Co-authored-by: Andriy Svyryd <AndriySvyryd@users.noreply.github.com>
@TheFanatr TheFanatr changed the title [Cosmos] Translate JObject Property [Cosmos] Translate __jObject Property Aug 22, 2020
@TheFanatr TheFanatr changed the title [Cosmos] Translate __jObject Property [Cosmos] Translate __jObject to Access Root Aug 22, 2020
@AndriySvyryd AndriySvyryd merged commit b72ade9 into dotnet:release/5.0 Aug 22, 2020
@AndriySvyryd
Copy link
Member

Thanks for your contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comsos Provider EntityEntry.ReloadAsync Non-Functional
3 participants