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

For PutAsync, allow selecting Replace vs Merge behavior #46

Closed
kzu opened this issue Jul 1, 2021 · 0 comments · Fixed by #47
Closed

For PutAsync, allow selecting Replace vs Merge behavior #46

kzu opened this issue Jul 1, 2021 · 0 comments · Fixed by #47
Labels
enhancement New feature or request

Comments

@kzu
Copy link
Member

kzu commented Jul 1, 2021

Currently we use TableOperation.InsertOrReplace in PutAsync. In some cases, it might be preferable for the consumer to use InsertOrMerge instead.

Back this issue
Back this issue

@kzu kzu added the enhancement New feature or request label Jul 1, 2021
kzu added a commit that referenced this issue Jul 1, 2021
In table table (not entity or document, which cannot do merge since the entity is stored as a whole), we can perform data merging by submitting only non-null properties for saving, so that when using Merge, we can fetch all columns and avoid overwriting existing values if no new values are provided.

According to the docs on the REST API operations on entities (see https://docs.microsoft.com/en-us/rest/api/storageservices/Merge-Entity?redirectedfrom=MSDN#remarks), null values are already skipped when doing this, so we just need to replicate that ourselves too by skipping those properties too when persisting.

NOTE: when using Merge, every PutAsync operation will incur an additional REST request for the retrieval of the merged data.

Fixes #46
kzu added a commit that referenced this issue Jul 1, 2021
In table table (not entity or document, which cannot do merge since the entity is stored as a whole), we can perform data merging by submitting only non-null properties for saving, so that when using Merge, we can fetch all columns and avoid overwriting existing values if no new values are provided.

According to the docs on the REST API operations on entities (see https://docs.microsoft.com/en-us/rest/api/storageservices/Merge-Entity?redirectedfrom=MSDN#remarks), null values are already skipped when doing this, so we just need to replicate that ourselves too by skipping those properties too when persisting.

NOTE: when using Merge, every PutAsync operation will incur an additional REST request for the retrieval of the merged data.

Fixes #46
@kzu kzu closed this as completed in #47 Jul 1, 2021
kzu added a commit that referenced this issue Jul 1, 2021
In table table (not entity or document, which cannot do merge since the entity is stored as a whole), we can perform data merging by submitting only non-null properties for saving, so that when using Merge, we can fetch all columns and avoid overwriting existing values if no new values are provided.

According to the docs on the REST API operations on entities (see https://docs.microsoft.com/en-us/rest/api/storageservices/Merge-Entity?redirectedfrom=MSDN#remarks), null values are already skipped when doing this, so we just need to replicate that ourselves too by skipping those properties too when persisting.

NOTE: when using Merge, every PutAsync operation will incur an additional REST request for the retrieval of the merged data.

Fixes #46
@devlooped devlooped locked and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant