-
Notifications
You must be signed in to change notification settings - Fork 8
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
[Feature]: 5959961188 - CosmosDB Optimistic concurrency through e-tags #16
base: development
Are you sure you want to change the base?
[Feature]: 5959961188 - CosmosDB Optimistic concurrency through e-tags #16
Conversation
- Upgraded IEvangelist.Azure.CosmosRepository package version - Added new settings class for CosmosDB module - Updated templates to generate code supporting optimistic concurrency if enabled in settings - Optimistic concurrency is handled using Etag property of Azure Cosmos documents - Introduced dictionary to track Etags for each entity in the base repository class
…dules.NET into 2-feature-5959961188
The CosmosDB module has been updated to improve concurrency management. The 'Use Optimistic Concurrency Default' setting type has been changed from checkbox to switch, with an added hint for clarity. In the 'PopulateFromEntity' method, the parameter type was corrected. Additionally, a new statement was added in the else block of this method for better handling when not using optimistic concurrency.
All of the project, barring one (CosmosDB) have the Use Optimistic Concurrency turned off.
@joelsteventurner please do not merge this PR, it seems I can do it now, and I am happy with the implementation. However I do have a question about Setting Group Extensions as per this comment. If you could spend 5 minutes with me tomorrow to show me how then I can complete this task |
The new version introduces support for Optimistic Concurrency using ETag, enhancing the functionality of the CosmosDB module. This update follows the previous fix for an issue with nullable collections not being realized correctly in version 1.0.3.
@class.AddField("string?", "etag", field => | ||
{ | ||
field.Private(); | ||
field.AddAttribute($"{UseType("Newtonsoft.Json.JsonProperty")}(\"_etag\")"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to revisit this in the future. If I add the attribute to the public property, it doesn't deserialize the etag correctly when reading from the repository. This is true if I do not add the public property either. The public can also not implement the ICosmodDBDocument
interface, even though that interface implements IItemWithEtag
. There is also a problem when adding the interface implementation for Etag
on the ICosmosDBDocument
interface.
I am not happy with this implementation, but it seems to be the only combination that works. The public property for Etag
below is superfluous, and is never used. It SHOULD not break the functionality to retrieve the etag if I remove this.
synchronizing branches via PR because I accidentally created the feature branch from master and not development
Tested every test project, ran the integration tests for the AdvancedMappingCrud.Cosmos.Tests project in VS, reviewed applied all the changes that my code made (especially the HttpClient nuget version) to all test applications.
The 'GetEtag' method has been refactored to only be added when optimistic concurrency is in use. This change reduces unnecessary code and improves performance by avoiding the execution of this method when it's not needed. The 'GetEtag' method was also removed from several test repositories as part of this optimization. "Refactored Etag retrieval for optimistic concurrency The 'GetEtag' method has been conditionally added only when optimistic concurrency is in use. This change reduces unnecessary code execution and improves performance. The 'GetEtag' method was also removed from several test repositories as part of this optimization."
Merging from IA source
- Updated various package versions across multiple projects. - Refactored the way Nuget dependencies are handled, now using output target to determine version. - Made minor changes in CosmosDBRepositoryBase.cs for better code readability. - Adjusted project GUIDs in Intent.Modules.NET.sln.
Signed-off-by: Stephan Johnson <stephanjohnson@users.noreply.github.com>
The commit includes updates to the version numbers of several modules. The changes are mainly in the .imodspec files where the version number has been incremented. Additionally, there's a change in NuGetPackages.cs file where the MicrosoftExtensionsHttp method now returns an instance of NugetPackageInfo instead of NugetPackageInfo directly. Also, it corrects the version number for when GetMaxNetAppVersion() returns (5, 0). Lastly, a reference to 'Microsoft.Extensions.Http' in a test project file was downgraded from version "8.0.0" to "7.0.0".
b607d2d
to
e06d897
Compare
4f3904f
to
61fc65c
Compare
Implemented Optimistic Concurrency Control functionality on the CosmosDB module.
As per this issue comment: