I notice the AuditScope
got .Event
properties which contains the value the event logs. So it can convert to json by using this command
var Scope = AuditScope.Create("Account:Suspend", () => user);
//Change value properties on user object
//Save into database
//Retrieve eventlog from audit
var EventInJson = Scope.Event.ToJson();
So I decide to not use CustomDataProvider, so I configure Audit.Net like this
Audit.Core.Configuration.Setup();
But the New Object
was missing inside the Target Object
. Sample result
{
"EventType": "Account:Suspend",
"Environment": {
"UserName": "test",
"MachineName": "test",
"DomainName": "test",
"CallingMethodName": "Account.API.Controllers.AccountController+<UpdateSuspend>d__35.MoveNext()",
"AssemblyName": "Account.API, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"Culture": "en-MY"
},
"Target": {
"Type": "ApplicationUser",
"Old": {
"CountryId": 1,
"IsDeleted": false,
"IsSuspend": true,
"RiskLevelId": 0,
"CreationDate": "2018-10-05T04:51:32.485",
"LastLoginDate": "2018-10-05T04:51:32.486",
"Id": 23,
"UserName": "user",
"NormalizedUserName": "test",
"Email": "test@test.com",
"NormalizedEmail": "test@test.com",
"EmailConfirmed": false,
"SecurityStamp": "Test",
"ConcurrencyStamp": "test",
"PhoneNumberConfirmed": false,
"TwoFactorEnabled": false,
"LockoutEnd": "2018-12-18T04:15:56.2490628+00:00",
"LockoutEnabled": false,
"AccessFailedCount": 0
}
},
"StartDate": "2019-01-08T09:35:34.8363926Z",
"Duration": 0
}
Is possible to use without data provider?