30% OFF - 10th Anniversary discount on new purchases until December 15 with code: ZZZANNIVERSARY10
Audit
Description
The Dapper Plus audit feature allows you to track changes of all modifications that happened in the database during the Bulk Operations. Also, it lets you create a history of who modified a table, what was the old value and new value.
Key Features
- Allow getting a history of modification
- Allow storing the history in a database or log file
- Allow tracking who, what, when a modification occurred
- Allow knowing what the old and the new value are
Getting Started
To use the audit feature, you need to enable it and provide a list of AuditEntry
that will be populated during the operations.
List<AuditEntry> auditEntries = new List<AuditEntry>(); connection.UseBulkOptions(x => { x.AuditEntries = auditEntries; x.UseAudit = true; }) .BulkMerge(list);
Try it: .NET Core | .NET Framework
Scenarios
- Saving audit history in a database
- Saving the audit history in a log file
Options
Name | Description |
---|---|
UseAudit | Gets or sets the UseAudit property. When the UseAudit property is true , the AuditEntries property stores auditing metadata about INSERTED , UPDATED , and DELETED rows and values. |
AuditEntries | Gets or sets the AuditEntries property. The AuditEntries property stores auditing metadata about INSERTED , UPDATED , and DELETED rows and values. This option requires to set the UseAudit property to true . |
Methods
Name | Description |
---|---|
AuditMode | The AuditMode method allows you to exclude or include properties from the auditing. |
Entities
Name | Description |
---|---|
AuditActionType | The AuditActionType enum represents the action that has been performed (Delete, Insert or Update). |
AuditEntry | The AuditEntry class represents the auditing row metadata that has been modified. |
AuditEntryItem | The AuditEntryItem class represents the auditing value metadata of a row that has been modified. |
AuditModeType | The AuditModeType enum represents if all properties should be included or excluded from the auditing. The default value is AuditModeType.IncludeAll . |
ColumnMappingAuditModeType | The ColumnMappingAuditModeType enum represents if a specific property should be included or excluded from the auditing. The default value is ColumnMappingAuditModeType.Inherit . |
FAQ
Why enabling this option decreases the performance?
When enabling this options, additional SQL are required such as returning all old and new values.
ZZZ Projects