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
Remarks
Initializes a new instance of the IBasicItemService class with the specified dependencies.
Constructors
BasicItemService(IBasicItemStore)
Provides methods for creating new items and managing items in the system.
Declaration
public BasicItemService(IBasicItemStore basicItemStore)
Parameters
Type | Name | Description |
---|---|---|
IBasicItemStore | basicItemStore | The item store used to store and retrieve items. |
Remarks
Initializes a new instance of the IBasicItemService class with the specified dependencies.
Methods
CloneAsync(string, string, CancellationToken)
Clones an item with the specified Id
Declaration
public Task CloneAsync(string itemId, string tableName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemId | The Id of the item to delete. |
string | tableName | The table used to retrieve data. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
DeleteAsync(string, string, CancellationToken)
Deletes an item with the specified Id by changing the status to Deleted
Declaration
public Task DeleteAsync(string itemId, string tableName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemId | The Id of the item to delete. |
string | tableName | The table used to retrieve data. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
DeleteFromStorageAsync(string, string, CancellationToken)
Deletes from storage an item with the specified Id
Declaration
public Task DeleteFromStorageAsync(string itemId, string tableName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemId | The Id of the item to delete. |
string | tableName | The table used to retrieve data. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
GetItemAsync(string, string, CancellationToken)
Retrieves an item by its Id.
Declaration
public Task<BasicItem> GetItemAsync(string itemId, string tableName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | itemId | The Id of the item to retrieve. |
string | tableName | The table used to retrieve data. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<BasicItem> | The item with the specified IdMaster, or null if no item is found. |
GetItemByFilterAsync(BasicItemFilter, string, CancellationToken)
Retrieves a basic item based on the provided filter.
Declaration
public Task<BasicItem> GetItemByFilterAsync(BasicItemFilter filter, string tableName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
BasicItemFilter | filter | The BasicItemFilter used to retrieve the item. |
string | tableName | The table used to retrieve data. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<BasicItem> | A basic items. |
GetItemCountAsync(BasicItemFilter, string, CancellationToken)
Retrieves the number of basic items based on the provided filter.
Declaration
public Task<long> GetItemCountAsync(BasicItemFilter filter, string tableName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
BasicItemFilter | filter | The BasicItemFilter used to retrieve the count of basic items. |
string | tableName | The table used to retrieve data. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<long> | The number of basic items that match the provided filter. |
GetItemsByFilterAsync(BasicItemFilter, string, CancellationToken)
Retrieves a collection of basic items based on the provided filter.
Declaration
public Task<IEnumerable<BasicItem>> GetItemsByFilterAsync(BasicItemFilter filter, string tableName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
BasicItemFilter | filter | The BasicItemFilter used to retrieve the context items. |
string | tableName | The table used to retrieve data. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<BasicItem>> | A collection of basic items. |
GetNewItemAsync(string, CancellationToken)
Creates a new item with default values.
Declaration
public Task<BasicItem> GetNewItemAsync(string tableName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | The table used to retrieve data. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<BasicItem> | A new item. |
SetStatusAsync(string, string, string, CancellationToken)
Sets the status of an item with the specified Id.
Declaration
public Task SetStatusAsync(string itemId, string status, string tableName, 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 | tableName | The table used to retrieve data. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |