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
…tting to query the original values of the entities from the database explicitly to properly set the Original values when using DbContext's `Update` or `Remove` methods. (#53, #167, #291, #335, #345, #606, #607)
Starting from version 21.0.2, the Audit.EntityFramework and Audit.EntityFramework.Core libraries introduce a new feature.
The setting called ReloadDatabaseValues can be globally or individually configured for a DbContext instance. It determines whether the original values of audited entities should be fetched from the database prior to saving the audit event.
Consider the following examples of update and delete operations:
If the ReloadDatabaseValues is not set to true, the EF Change Tracker will lack knowledge of the original values.
Enabling the ReloadDatabaseValues setting triggers an extra database query to retrieve the original values prior to the update operation. As a result, the audit event will contain the original values.
Audit.net is not capturing old value and new value when saving into the DB. What am I missing?
{
"EventType": "RepositoryContext",
"Environment": {
"UserName": "myuser",
"MachineName": "DESKTOP",
"DomainName": "DESKTOP",
"CallingMethodName": "PWA.Repository.Repositories.RepositoryWrapper.Save()",
"AssemblyName": "PWA.Repository, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"Culture": "en-US"
},
"StartDate": "2020-10-23T09:42:07.1808807Z",
"EndDate": "2020-10-23T09:42:07.2860043Z",
"Duration": 105,
"EntityFrameworkEvent": {
"Database": "myDB",
"Entries": [
{
"Table": "UserAdditionalInfos",
"Action": "Update",
"PrimaryKey": {
"UserAdditionalInfoId": 3
},
"Changes": [
{
"ColumnName": "AccountStatusId",
"OriginalValue": 1,
"NewValue": 1
},
{
"ColumnName": "CreatedDate",
"OriginalValue": "0001-01-01T00:00:00",
"NewValue": "0001-01-01T00:00:00"
},
{
"ColumnName": "FirstName",
"OriginalValue": "MyFirstName",
"NewValue": "MyFirstName"
},
{
"ColumnName": "LastName",
"OriginalValue": "MyLastName",
"NewValue": "MyLastName"
},
{
"ColumnName": "UserId",
"OriginalValue": "5e0df94d-103e-4136-b5e0-428e853ee62f",
"NewValue": "5e0df94d-103e-4136-b5e0-428e853ee62f"
},
{
"ColumnName": "UserRoleId",
"OriginalValue": "1",
"NewValue": "1"
}
],
"ColumnValues": {
"UserAdditionalInfoId": 3,
"AccountStatusId": 1,
"CreatedDate": "0001-01-01T00:00:00",
"FirstName": "MyFirstName",
"LastName": "MyLastName",
"UserId": "5e0df94d-103e-4136-b5e0-428e853ee62f",
"UserRoleId": "1"
},
"Valid": true
}
],
"Result": 1,
"Success": true
}
}
The text was updated successfully, but these errors were encountered: