-
-
Notifications
You must be signed in to change notification settings - Fork 462
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
Fix issues with deletions and updates in dirty tracked session #3343
Conversation
@@ -26,6 +27,7 @@ public abstract partial class DocumentSessionBase | |||
_workTracker.Add(deletion); | |||
|
|||
documentStorage.Eject(this, entity); | |||
ChangeTrackers.RemoveAll(x => ReferenceEquals(entity, x.Document)); |
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.
You've got to do that by document identity and not just the reference equals
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.
Why? Eject does the same:
And there is this method, which I think isn't used anymore:
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.
Because what if someone passes the session around and passes a different object with the same id in to delete it which people have absolutely done before even though it sounds weird. What if the document is immutable -- which people absolutely do as well -- so they might have modified the document and hence created a new document that they then passed into the Delete() method.
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.
Ok, I get your point. But this should then be done for Eject as well, shouldn't it?
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.
DocumentStorage.Eject() does it by identity
@e-tobi I have a magic window of time today to push a Marten release. I'll take it from here. Thanks for doing this! |
No description provided.