Is it possible to record a fake date for the ModifiedOn property of the audit trail?
We have a custom Date class that our system uses throughout to retrieve the current date (instead of using DateTime.Now for example). Ideally I would like to get the date value recorded for the ModifiedOn property from this class.
The reason for this is that we have clients testing the solution we created for them, their product is based around scheduled events, normally taking place each month. To speed up the testing, we have added a controller that allows them to select the date the system currently uses, so they can easily skip forward through time and test the system.
The problem is that the audit trail continues to use the real date. This leads to inconsistencies in the data. Also, we use the audit trail to identify when things have been modified, i.e. a particular property changed, this is then used to trigger events, such as notification emails etc. However, as the ModifiedOn property always uses the real date, these changes are not picked up.
Please pardon our delayed response.These days we've been a little bit overloaded with support queries.
In our code the ModifiedOn property is set in the Save method of the AuditDataStore class:
Take special note that the LocalAuditTimestampStrategy class is used by default (see its source code at ...\DevExpress.Persistent\DevExpress.Persistent.Base\AuditTrail\IAuditTimeStampStrategy.cs).[C#]
... auditDataStoreItem.ModifiedOn = timestampStrategy.GetTimestamp(item).AddMilliseconds((correctionValue++)/100000.0); ...
You can implement your own time stamp strategy and set it to the TimestampStrategy property of the AuditTrailService class.
You can learn more on this in the respective product documentation.
I hope you find this information helpful.
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.