Class AuditEventStore
Implements
Inherited Members
Namespace: DataWeb.Audit.SqlServer
Assembly: DataWeb.Data.SqlServer.dll
Syntax
public class AuditEventStore : IAuditEventStore
Constructors
AuditEventStore(ISqlHelper)
Declaration
public AuditEventStore(ISqlHelper sqlHelper)
Parameters
| Type | Name | Description |
|---|---|---|
| ISqlHelper | sqlHelper |
Properties
Name
Gets the name of the store implementation.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
DeleteExpiredEntriesAsync(DateTimeOffset, CancellationToken)
Deletes all audit events whose expiration date is earlier than the specified date.
Declaration
public Task DeleteExpiredEntriesAsync(DateTimeOffset expirationDate, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTimeOffset | expirationDate | The cutoff date; entries with an expiration date before this value will be deleted. |
| CancellationToken | cancellationToken | A token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task |
GetAuditEventsAsync(AuditEventFilter, CancellationToken)
Retrieves a collection of audit events matching the specified filter.
Declaration
public Task<IEnumerable<AuditEvent>> GetAuditEventsAsync(AuditEventFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AuditEventFilter | filter | The filter criteria used to query audit events. |
| CancellationToken | cancellationToken | A token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<AuditEvent>> | A collection of AuditEvent matching the filter. |
SetAsync(AuditEvent, CancellationToken)
Persists a new audit event to the store.
Declaration
public Task SetAsync(AuditEvent auditEvent, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AuditEvent | auditEvent | The audit event to save. The Id must not be null or empty. |
| CancellationToken | cancellationToken | A token to cancel the asynchronous operation. |
Returns
| Type | Description |
|---|---|
| Task |