Class BasicItemStore
Manages basic item data retrieval and modification operations in Azure Cosmos DB.
Implements
Inherited Members
Namespace: DataWeb.Structure.AzureCosmosDB
Assembly: DataWeb.Data.AzureCosmosDB.dll
Syntax
public class BasicItemStore : IBasicItemStore
Constructors
BasicItemStore(ICosmosHelper, TimeProvider)
Manages basic item data retrieval and modification operations in Azure Cosmos DB.
Declaration
public BasicItemStore(ICosmosHelper cosmosHelper, TimeProvider timeProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| ICosmosHelper | cosmosHelper | |
| TimeProvider | timeProvider |
Properties
Name
Gets the name of the file storage store.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
DeleteAsync(string, string, CancellationToken)
Deletes a specific item from the container.
Declaration
public Task DeleteAsync(string itemId, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | itemId | The unique identifier of the item to delete. |
| string | storageContainerData | The container name or storage information. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when itemId or storageContainerData is null or empty. |
GetItemAsync(BasicItemFilter, string, CancellationToken)
Retrieves a single item matching the specified filter criteria.
Declaration
public Task<BasicItem> GetItemAsync(BasicItemFilter filter, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| BasicItemFilter | filter | The filter criteria to apply when retrieving the item. |
| string | storageContainerData | The container name or storage information to query. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<BasicItem> | The first BasicItem matching the filter, or null if no match found. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when filter is null. |
| ArgumentException | Thrown when storageContainerData is null or empty. |
GetItemCountAsync(BasicItemFilter, string, CancellationToken)
Retrieves the total count of items matching the specified filter criteria.
Declaration
public Task<long> GetItemCountAsync(BasicItemFilter filter, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| BasicItemFilter | filter | The filter criteria to apply when counting items. |
| string | storageContainerData | The container name or storage information to query. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<long> | The total count of items matching the filter. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when filter is null. |
| ArgumentException | Thrown when storageContainerData is null or empty. |
GetItemDataAsync(string, string, CancellationToken)
Declaration
public Task<Dictionary<string, object>> GetItemDataAsync(string itemId, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | itemId | |
| string | storageContainerData | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Dictionary<string, object>> |
GetItemsAsync(BasicItemFilter, string, CancellationToken)
Retrieves a collection of items matching the specified filter criteria.
Declaration
public Task<IEnumerable<BasicItem>> GetItemsAsync(BasicItemFilter filter, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| BasicItemFilter | filter | The filter criteria to apply when retrieving items. |
| string | storageContainerData | The container name or storage information to query. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<BasicItem>> | A collection of BasicItem objects matching the filter. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when filter is null. |
| ArgumentException | Thrown when storageContainerData is null or empty. |
SetItemDataAsync(string, Dictionary<string, object>, List<string>, string, CancellationToken)
Updates or inserts item data based on whether the item already exists.
Declaration
public Task<string> SetItemDataAsync(string itemId, Dictionary<string, object> data, List<string> modifiedFields, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | itemId | The unique identifier of the item. If VoidId, creates a new item. |
| Dictionary<string, object> | data | A dictionary containing the item's data fields. |
| List<string> | modifiedFields | A list of field names that have been modified. |
| string | storageContainerData | The container name or storage information to update or insert into. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<string> | The item ID (either provided or newly generated). |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when itemId or storageContainerData is null or empty. |
| ArgumentNullException | Thrown when data or modifiedFields is null. |
SetStatusAsync(string, string, string, CancellationToken)
Updates the status of a specific item.
Declaration
public Task SetStatusAsync(string itemId, string status, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | itemId | The unique identifier of the item to update. |
| string | status | The new status value for the item. |
| string | storageContainerData | The container name or storage information. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when itemId, status, or storageContainerData is null or empty. |