Class AuditEventStore
Implements
Inherited Members
Namespace: DataWeb.Audit.AzureCosmosDB
Assembly: DataWeb.Data.AzureCosmosDB.dll
Syntax
public class AuditEventStore : IAuditEventStore
Constructors
AuditEventStore(ICosmosHelper, IConfigurationService)
Declaration
public AuditEventStore(ICosmosHelper cosmosHelper, IConfigurationService configurationService)
Parameters
| Type | Name | Description |
|---|---|---|
| ICosmosHelper | cosmosHelper | |
| IConfigurationService | configurationService |
Properties
Name
Gets the name of the store implementation.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
ConvertActionToString(AuditEventAction)
Converts an AuditEventAction enum value to its string representation.
Declaration
public static string ConvertActionToString(AuditEventAction action)
Parameters
| Type | Name | Description |
|---|---|---|
| AuditEventAction | action | The action to convert. |
Returns
| Type | Description |
|---|---|
| string | The string representation of the action. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown when |
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 |