Ensure appropriate create and update dates are set on updated dictionary items to allow distinguishing between created and update for server events #19925
+20
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prerequisites
Resolves an issue found in internal testing:
Description
On investigating the issue here is due to dictionary items being a bit of a special case. They are entities in the sense of implementing
IEntitythat gives them a create and updated date, but we don't store these in the database. Hence it doesn't really matter what they are set to apart from in the logic with have inServerEventSender, where we compare the two dates to determine whether to emit aCreatedorUpdatedevent.Note that we don't have access to using whether or not the entity has an identity, as these events fire after persistence when the identity is known for both creates and updates.
So I've added code into the update dictionary item event to set the dates explicitly to something that can be used to determine that this is an update not a create. This means when the base
UpdatingEntity()method is called, the dates won't be initialized to the same value.Testing
Put a break point in
ServerEventSender.NotifySavedAsyncand verify that the emitted event has the correctEventTypefor created and updated dictionary items.Merge and Release
Note the
TODOadded that should be actioned when this is merged into thev17/feature/utc-system-datesbranch.