Class BasicItemService
Provides methods for creating new items and managing items in the system.
Implements
Inherited Members
Namespace: DataWeb.Structure
Assembly: DataWeb.Core.dll
Syntax
public sealed class BasicItemService : IBasicItemService
Constructors
BasicItemService(IServiceProvider)
Provides methods for creating new items and managing items in the system.
Declaration
public BasicItemService(IServiceProvider serviceProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceProvider | serviceProvider | The service provider. |
Methods
CloneAsync(string, string, string, CancellationToken)
Clones an item with the specified Id.
Declaration
public Task CloneAsync(string itemId, string storageName, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | itemId | The Id of the item to clone. |
| string | storageName | The name of the storage to use. |
| string | storageContainerData | The storage container data. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |
DeleteAsync(string, string, string, CancellationToken)
Deletes an item with the specified Id by changing the status to Deleted.
Declaration
public Task DeleteAsync(string itemId, string storageName, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | itemId | The Id of the item to delete. |
| string | storageName | The name of the storage to use. |
| string | storageContainerData | The storage container data. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |
DeleteFromStorageAsync(string, string, string, CancellationToken)
Deletes from storage an item with the specified Id.
Declaration
public Task DeleteFromStorageAsync(string itemId, string storageName, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | itemId | The Id of the item to delete. |
| string | storageName | The name of the storage to use. |
| string | storageContainerData | The storage container data. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |
GetBasicItemStores()
Returns a collection of all basic item stores associated with this service.
Declaration
public IEnumerable<IBasicItemStore> GetBasicItemStores()
Returns
| Type | Description |
|---|---|
| IEnumerable<IBasicItemStore> | A collection of IBasicItemStore instances. |
GetItemAsync(string, string, string, CancellationToken)
Retrieves an item by its Id.
Declaration
public Task<BasicItem> GetItemAsync(string itemId, string storageName, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | itemId | The Id of the item to retrieve. |
| string | storageName | The name of the storage to use. |
| string | storageContainerData | The storage container data. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<BasicItem> | The item with the specified IdMaster, or null if no item is found. |
GetItemByFilterAsync(BasicItemFilter, string, string, CancellationToken)
Retrieves a basic item based on the provided filter.
Declaration
public Task<BasicItem> GetItemByFilterAsync(BasicItemFilter filter, string storageName, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| BasicItemFilter | filter | The BasicItemFilter used to retrieve the item. |
| string | storageName | The name of the storage to use. |
| string | storageContainerData | The storage container data. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<BasicItem> | A basic item. |
GetItemCountAsync(BasicItemFilter, string, string, CancellationToken)
Retrieves the number of basic items based on the provided filter.
Declaration
public Task<long> GetItemCountAsync(BasicItemFilter filter, string storageName, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| BasicItemFilter | filter | The BasicItemFilter used to retrieve the count of basic items. |
| string | storageName | The name of the storage to use. |
| string | storageContainerData | The storage container data. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<long> | The number of basic items that match the provided filter. |
GetItemsByFilterAsync(BasicItemFilter, string, string, CancellationToken)
Retrieves a collection of basic items based on the provided filter.
Declaration
public Task<IEnumerable<BasicItem>> GetItemsByFilterAsync(BasicItemFilter filter, string storageName, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| BasicItemFilter | filter | The BasicItemFilter used to retrieve the items. |
| string | storageName | The name of the storage to use. |
| string | storageContainerData | The storage container data. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<BasicItem>> | A collection of basic items. |
GetNewItemAsync(string, string, CancellationToken)
Creates a new item with default values.
Declaration
public Task<BasicItem> GetNewItemAsync(string storageName, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | storageName | The name of the storage to use. |
| string | storageContainerData | The storage container data. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<BasicItem> | A new item. |
SetStatusAsync(string, string, string, string, CancellationToken)
Sets the status of an item with the specified Id.
Declaration
public Task SetStatusAsync(string itemId, string status, string storageName, string storageContainerData, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | itemId | The Id of the item to update. |
| string | status | The new status of the item. |
| string | storageName | The name of the storage to use. |
| string | storageContainerData | The storage container data. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |