AuditEntry class
Namespace: Tenantry.Pro.EfCore · Package: Tenantry.Pro.EfCore · API reference
One entity change an EF Core SaveChanges call saved, recorded by audit logging (pro.AddAuditLogging()).
public sealed record AuditEntry : IEquatable<AuditEntry>Implements IEquatable<AuditEntry>.
Properties
Action
The type of change: insert, update, or delete.
public required AuditAction Action { get; init; }Value: AuditAction
Actor
The user or service that made the change, as IAuditContextProvider gives it: null unless you register one that names it.
public string? Actor { get; init; }Value: string
ChangedProperties
The names of properties that changed, as AuditEntry.OldValues and AuditEntry.NewValues name them. For inserts and deletes this is all tracked properties; for updates it is only the modified properties.
public required IReadOnlySet<string> ChangedProperties { get; init; }Value: IReadOnlySet<string>
Properties excluded with AuditOptions.ExcludeProperty<TEntity> are not in it, nor in AuditEntry.OldValues and AuditEntry.NewValues.
CorrelationId
An id that ties the change to the request, message or job that made it, as IAuditContextProvider gives it: by default the current trace's id, or null when there is no trace.
public string? CorrelationId { get; init; }Value: string
Data
Values of your own, from IAuditContextProvider. Empty by default.
public IReadOnlyDictionary<string, object?> Data { get; init; }Value: IReadOnlyDictionary<string, object>
EntityType
EF Core's name for the entity type (IEntityType.Name): the full name of its CLR type, such as MyApp.Orders.Order, or for a shared-type entity (a many-to-many join, a property bag) the name it is mapped with. An owned type's name also names its owner and navigation.
public required string EntityType { get; init; }Value: string
NewValues
Property values after the change. Empty for AuditAction.Delete; populated for AuditAction.Insert (all properties) and AuditAction.Update (changed properties only).
public required IReadOnlyDictionary<string, object?> NewValues { get; init; }Value: IReadOnlyDictionary<string, object>
Named as in AuditEntry.OldValues.
OldValues
Property values before the change. Empty for AuditAction.Insert; populated for AuditAction.Update (changed properties only) and AuditAction.Delete (all properties).
public required IReadOnlyDictionary<string, object?> OldValues { get; init; }Value: IReadOnlyDictionary<string, object>
A property of a complex type (ComplexProperty) is named by its path, as Address.City, and an optional complex property that is null by its own path, with a null value. A complex collection (ComplexCollection, EF Core 10) is recorded whole when it changes: a list with one dictionary of values, named the same way, for each element. Values are copies taken before the save, so changing the entity afterwards does not change them.
PrimaryKey
A string representation of the entity's primary key value(s), each in the invariant culture: a date or time to the tick (2026-10-02T13:04:05.1230000), a byte array in hexadecimal (0x0102), and a value-converted key that cannot be formatted so, such as a strongly typed id, as the value it is stored as. Composite keys are comma-separated. null when no primary key is defined.
public required string? PrimaryKey { get; init; }Value: string
TableName
The database table name mapped by the entity's EF Core metadata. Falls back to the entity CLR type name when the provider has no table mapping.
public required string TableName { get; init; }Value: string
TenantId
The tenant current when the change was saved, formatted with the invariant culture, as jobs, messages and traces carry it. null when no tenant scope is active (e.g. admin background jobs).
public required string? TenantId { get; init; }Value: string
Timestamp
The UTC time at which SaveChanges saved the change.
public required DateTimeOffset Timestamp { get; init; }Value: DateTimeOffset