-
Notifications
You must be signed in to change notification settings - Fork 46
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
handler.Original has same values as handler.Entity in GlobalUpdating. #52
Comments
This is because new entities don't have "original values". The concept of original values is for entities that have already been persisted. |
I understand that Original refers to the in-memory "original" entity rather than the entity that's in the database in the moment of the transaction. |
So I rephrase the question: How to detect if a entity has been retrieved from a |
If the entity is new, the |
Let's consider following scenario:
And the code looks like this:
In this case the GlobalUpdating triggers will be called and both handler.Original and handler.Entity will have "Baz" in the Name field. |
I've created a method using this library to control update operations that looks like this:
The problem I get is that both handler.Original and handler.Entity have the new values and my ChangeAllowed method always returns true.
This happens only when I'm passing a new Entity to the Update method from DbSet.
It doesn't happen if I modify a entity queried from the DbSet and then call the Update method.
The text was updated successfully, but these errors were encountered: