Class BasicItemStore
Manages basic item data retrieval and modification operations in SQL Server.
Implements
Inherited Members
Namespace: DataWeb.Structure.SqlServer
Assembly: DataWeb.Data.SqlServer.dll
Syntax
public class BasicItemStore : IBasicItemStore
Constructors
BasicItemStore(ISqlHelper)
Manages basic item data retrieval and modification operations in SQL Server.
Declaration
public BasicItemStore(ISqlHelper sqlHelper)
Parameters
| Type | Name | Description |
|---|---|---|
| ISqlHelper | sqlHelper |
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)
Permanently deletes an item from storage.
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 table name or storage container to delete from. |
| 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 table name or storage container 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 table name or storage container 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)
Retrieves the data of a specific item by its ID.
Declaration
public Task<Dictionary<string, object>> GetItemDataAsync(string itemId, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | itemId | The unique identifier of the item to retrieve. |
| string | storageContainerData | The table name or storage container to query. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<Dictionary<string, object>> | A dictionary containing the item's data, or null if not found. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when itemId or storageContainerData is null or empty. |
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 table name or storage container 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 table name or storage container 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 table name or storage container to update. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when itemId, status, or storageContainerData is null or empty. |