You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have implemented below code in SavingChangesAsync interceptor. I want to implement AuditLogs for each entry/modification in table. How to get primaryKeyValue in case of entry.state == Added. How can I get newly generated Id. Right now I am getting some random value (-9223372036854774807) in case of entry.state==Added.
I have tried to do it with SavedChangesASync also but there I get entry.state as Unchanged always even if entry is Added or Modified.
@prrami Store generated key values are not available until the database has generated these values. This means they will never be available in SavingChangesAsync, since this is called before SQL is sent to the database. They are available in SavedChangesAsync, but it's currently not easy to know the original state of each entity at that point--you will have to maintain your own map, or use events that trigger when the state changes. Improving this is tracked by #32373.
I have implemented below code in SavingChangesAsync interceptor. I want to implement AuditLogs for each entry/modification in table. How to get primaryKeyValue in case of entry.state == Added. How can I get newly generated Id. Right now I am getting some random value (-9223372036854774807) in case of entry.state==Added.
I have tried to do it with SavedChangesASync also but there I get entry.state as Unchanged always even if entry is Added or Modified.
The text was updated successfully, but these errors were encountered: