Class AppErrorStore
Azure Cosmos DB implementation of the application error store for persisting and retrieving application errors.
Implements
Inherited Members
Namespace: DataWeb.Error.AzureCosmosDB
Assembly: DataWeb.Data.AzureCosmosDB.dll
Syntax
public class AppErrorStore : IAppErrorStore
Remarks
Provides full CRUD operations for application error records stored in the sys_apperrors container. Supports filtering by error ID and message, pagination, and bulk operations.
Constructors
AppErrorStore(ICosmosHelper, IConfigurationService, TimeProvider)
Azure Cosmos DB implementation of the application error store for persisting and retrieving application errors.
Declaration
public AppErrorStore(ICosmosHelper cosmosHelper, IConfigurationService configurationService, TimeProvider timeProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| ICosmosHelper | cosmosHelper | |
| IConfigurationService | configurationService | |
| TimeProvider | timeProvider |
Remarks
Provides full CRUD operations for application error records stored in the sys_apperrors container. Supports filtering by error ID and message, pagination, and bulk operations.
Properties
Name
Gets the name of the data store provider.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
GetCountAsync(CancellationToken)
Gets the total count of application errors in the store.
Declaration
public Task<long> GetCountAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Cancellation token for the async operation. |
Returns
| Type | Description |
|---|---|
| Task<long> | The total number of application error records. |
GetErrorAsync(AppErrorFilter, CancellationToken)
Retrieves a single application error based on the provided filter criteria.
Declaration
public Task<AppError> GetErrorAsync(AppErrorFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AppErrorFilter | filter | Filter criteria including error ID and error message. Must not be null. |
| CancellationToken | cancellationToken | Cancellation token for the async operation. |
Returns
| Type | Description |
|---|---|
| Task<AppError> | An AppError object if found; otherwise null. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
GetErrorsAsync(AppErrorFilter, CancellationToken)
Retrieves a collection of application errors based on the provided filter criteria.
Declaration
public Task<IEnumerable<AppError>> GetErrorsAsync(AppErrorFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AppErrorFilter | filter | Filter criteria including count, error ID, and error message. Must not be null. |
| CancellationToken | cancellationToken | Cancellation token for the async operation. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<AppError>> | An enumerable collection of AppError objects matching the filter criteria. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
RemoveAllAsync(CancellationToken)
Removes all application error records from the store.
Declaration
public Task RemoveAllAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Cancellation token for the async operation. |
Returns
| Type | Description |
|---|---|
| Task |
Remarks
This operation cannot be undone. All error records will be permanently deleted.
SetAsync(string, string, string, string, CancellationToken)
Inserts a new application error record into the store.
Declaration
public Task SetAsync(string errorMessage, string errorStackTrace, string errorUrl, string userIdMaster, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | errorMessage | The error message text. Must not be null or empty. |
| string | errorStackTrace | The error stack trace for debugging information. |
| string | errorUrl | The URL where the error occurred. |
| string | userIdMaster | The ID of the user who encountered the error, if applicable. |
| CancellationToken | cancellationToken | Cancellation token for the async operation. |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |