Class AuditService
Provides audit events services.
Implements
Inherited Members
Namespace: DataWeb.Audit
Assembly: DataWeb.Core.dll
Syntax
public class AuditService : IAuditService
Remarks
Initializes a new instance of the AuditService class with the specified dependencies.
Constructors
AuditService(IHttpService, IConfigurationService, IAuditEventStore, TimeProvider)
Provides audit events services.
Declaration
public AuditService(IHttpService httpService, IConfigurationService configurationService, IAuditEventStore auditEventStore, TimeProvider timeProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| IHttpService | httpService | The IHttpService used to retrieve information about the request. |
| IConfigurationService | configurationService | The IConfigurationService used to retrieve application settings. |
| IAuditEventStore | auditEventStore | The IAuditEventStore used to store audit events. |
| TimeProvider | timeProvider |
Remarks
Initializes a new instance of the AuditService class with the specified dependencies.
Methods
DeleteExpiredEntriesAsync(DateTimeOffset, CancellationToken)
Asynchronously removes expired entries.
Declaration
public Task DeleteExpiredEntriesAsync(DateTimeOffset expirationDate, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTimeOffset | expirationDate | The entries with ExpirationDate older than this value will be deleted. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
GetAuditEventsAsync(AuditEventFilter, CancellationToken)
Asynchronously retrieves audit events that match the specified filter.
Declaration
public Task<IEnumerable<AuditEvent>> GetAuditEventsAsync(AuditEventFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AuditEventFilter | filter | The AuditEventFilter used to retrieve the audit events. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<AuditEvent>> | A task that represents the asynchronous operation. The task result contains the audit events. |
SetAuditEventAsync(AuditEvent, CancellationToken)
Asynchronously adds a audit event to the store.
Declaration
public Task SetAuditEventAsync(AuditEvent auditEvent, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AuditEvent | auditEvent | The AuditEvent to add to the store. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |