Simple EF(Core) Change Tracker base audit log library.
- Give entity key property value as your configuration (KeyPropertyName)
- Can get Environment data (IncludeEnvironmentData)
- Version
- MachineName
- UserName
- OSVersion
- UserDomainName
- Get Audit data for changed entities (AuditLogEntries)
- KeyPropertyValue
- EntityName
- OldValue
- NewValue
- AuditLogOperationType
- Added
- Updated
- Deleted
- Can exclude Entities from Audit flow (ExcludeEntities)
- Can mask Properties from Audit flow (MaskedProperties, masked with "******")
- If you get data with "AsNoTracking()", you can not get property change data
public class AuditConfiguration
{
public string KeyPropertyName { get; set; }
public bool IncludeEnvironmentData { get; set; }
public List<string> ExcludeEntities { get; set; } = new List<string>();
public List<string> MaskedProperties { get; set; } = new List<string>();
}
public class AuditEntryResult
{
public EnvironmentData EnvironmentData { get; set; }
public List<AuditLogEntry> AuditLogEntries { get; set; } = new List<AuditLogEntry>();
}
public class EnvironmentData
{
public string MachineName { get; set; }
public string OSVersion { get; set; }
public string UserDomainName { get; set; }
public string UserName { get; set; }
public string Version { get; set; }
}
public class AuditLogEntry
{
public string KeyPropertyValue { get; set; }
public string EntityName { get; set; }
public AuditLogOperationType AuditLogOperationType { get; set; }
public string OldValue { get; set; }
public string NewValue { get; set; }
}
public enum AuditLogOperationType
{
Added = 1,
Updated = 2,
Deleted = 3
}
var auditResponse =_context.ChangeTracker.GetAuditData(new AuditConfiguration
{
KeyPropertyName = "Id",
IncludeEnvironmentData = true,
MaskedProperties = new List<String>(){ "Password" }
});
- "KeyPropertyValue" select null refernce bug fixed
- Ef Version updated to 7.0.9
- Newtonsoft SerializeObject reference loop options changed
- Ef Version updated to 7.0.5
- Newtonsoft.Json Version updated to 13.0.3
- Newtonsoft SerializeObject reference loop bug fixed
- Ef Version updated to 7.0.1
- Newtonsoft.Json Version updated to 13.0.2
- Ef Version updated to 6.0.8
- Target Framework changed as net6.0
- Ef Version updated to 6.0.1
- MaskedEntities name changed as MaskedProperties
- NewValue data not mask bug fixed
- GetAuditData extension moved under ChangeTracker
- AuditConfigurations name changed to AuditConfiguration
- Null check added for ChangeTracker and AuditConfiguration
- AuditLogEntry.NewValue null bug fixed
- GetAuditData extension moved under ChangeTracker
- Base release
- Support Ef Core 5.0.12