DataWeb
Search Results for

    Show / Hide Table of Contents

    Class ItemService

    Provides methods for creating new items and managing items in the system.

    Inheritance
    object
    ItemService
    Implements
    IItemService
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Structure
    Assembly: DataWeb.Core.dll
    Syntax
    public class ItemService : IItemService
    Remarks

    Initializes a new instance of the ItemService class with the specified dependencies.

    Constructors

    ItemService(IStructureService, IItemStore, IContextItemStore, IRelationStore, TimeProvider)

    Provides methods for creating new items and managing items in the system.

    Declaration
    public ItemService(IStructureService structureService, IItemStore itemStore, IContextItemStore contextItemStore, IRelationStore relationStore, TimeProvider timeProvider)
    Parameters
    Type Name Description
    IStructureService structureService

    The structure service used to get information about the system's structure.

    IItemStore itemStore

    The item store used to store and retrieve items.

    IContextItemStore contextItemStore

    The context item store used to retrieve context items.

    IRelationStore relationStore

    The relation store used to store and retrieve relations.

    TimeProvider timeProvider
    Remarks

    Initializes a new instance of the ItemService class with the specified dependencies.

    Methods

    CloneSectionPartAsync(SectionPart, SectionPart, CancellationToken)

    Clones the properties of one section part to another.

    Declaration
    public Task CloneSectionPartAsync(Item.SectionPart sectionPart, Item.SectionPart sectionPartCloned, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Item.SectionPart sectionPart

    The Item.SectionPart to clone from.

    Item.SectionPart sectionPartCloned

    The Item.SectionPart to clone to.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    ComputeLabelAsync(Item, Element, IEnumerable<Section>, CancellationToken)

    Computes the label for an item based on its properties.

    Declaration
    public Task<string> ComputeLabelAsync(Item item, Element element, IEnumerable<Section> elementSections, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Item item

    The Item to compute the label for.

    Element element

    The Element the item belongs to.

    IEnumerable<Section> elementSections

    The Section of the element.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<string>

    A Task representing the asynchronous operation, which when completed will return a string representing the label of the item.

    DeleteAsync(string, CancellationToken)

    Deletes an item with the specified IdMaster.

    Declaration
    public Task DeleteAsync(string itemIdMaster, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to delete.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task representing the asynchronous operation.

    DeleteInactiveVersionAsync(string, Section, string, CancellationToken)

    Sets Deleted status for an inactive version.

    Declaration
    public Task DeleteInactiveVersionAsync(string itemIdMaster, Section section, string versionName, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The IdMaster of the item.

    Section section

    The Section of the item.

    string versionName

    The name of the version.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    DeleteMasterPartFromStorageAsync(string, CancellationToken)

    Deletes from storage the master part of an item with the specified IdMaster.

    Declaration
    public Task DeleteMasterPartFromStorageAsync(string itemIdMaster, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to delete the master part of.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task representing the asynchronous operation.

    DeleteRelationPartsFromStorageAsync(string, CancellationToken)

    Deletes from storage the relation parts of an item with the specified IdMaster.

    Declaration
    public Task DeleteRelationPartsFromStorageAsync(string itemIdMaster, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to delete the relation parts of.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task representing the asynchronous operation.

    DeleteWithChildrenAsync(string, bool, Navigation, CancellationToken)

    Deletes an item and its children from the database.

    Declaration
    public Task<ItemService.DeleteResult> DeleteWithChildrenAsync(string itemIdMaster, bool isDeleteFromAll, Navigation navigation, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to delete.

    bool isDeleteFromAll

    Whether to delete the item from all areas or just the current area.

    Navigation navigation

    The Navigation object containing the current area and language.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<ItemService.DeleteResult>

    A Task representing the asynchronous operation, which when completed will return a ItemService.DeleteResult object with details of the deletion.

    GetAncestorsAsync(string, CancellationToken)

    Gets the ancestors of the specified item.

    Declaration
    public Task<IEnumerable<Relation>> GetAncestorsAsync(string itemIdMaster, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to get the ancestors for.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IEnumerable<Relation>>

    A task representing the asynchronous operation.

    GetChildrenAsync(string, string, CancellationToken)

    Gets the children of the specified item in the specified section.

    Declaration
    public Task<IEnumerable<Relation>> GetChildrenAsync(string itemIdMaster, string sectionName = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to get the children for.

    string sectionName

    The name of the section to get the children for.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IEnumerable<Relation>>

    A task representing the asynchronous operation.

    GetContextItemAsync(ContextItemFilter, CancellationToken)

    Gets the count of context items based on the specified filter.

    Declaration
    public Task<ContextItem> GetContextItemAsync(ContextItemFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    ContextItemFilter filter

    The ContextItemFilter to apply.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<ContextItem>

    A task that represents the asynchronous operation. The task result contains the count of context items that match the filter.

    GetContextItemsAsync(ContextItemFilter, CancellationToken)

    Gets a collection of context items based on the specified filter.

    Declaration
    public Task<IEnumerable<ContextItem>> GetContextItemsAsync(ContextItemFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    ContextItemFilter filter

    The ContextItemFilter to apply.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IEnumerable<ContextItem>>

    A task that represents the asynchronous operation. The task result contains a collection of context items that match the filter.

    GetContextItemsCountAsync(ContextItemFilter, CancellationToken)

    Gets a single context item based on the specified filter.

    Declaration
    public Task<long> GetContextItemsCountAsync(ContextItemFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    ContextItemFilter filter

    The ContextItemFilter to apply.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<long>

    A task that represents the asynchronous operation. The task result contains a context item that matches the filter, or null if no matching item was found.

    GetDateModifiedAsync(string, CancellationToken)

    Gets the last modified date of the item.

    Declaration
    public Task<DateTimeOffset?> GetDateModifiedAsync(string itemIdMaster, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to get the date for.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<DateTimeOffset?>

    A Task representing the asynchronous operation, which when completed will return a DateTimeOffset representing the last modified date of the item.

    GetDescendantsAsync(string, CancellationToken)

    Gets the descendants of the specified item.

    Declaration
    public Task<IEnumerable<Relation>> GetDescendantsAsync(string itemIdMaster, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to get the descendants for.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IEnumerable<Relation>>

    A task representing the asynchronous operation.

    GetItem(MasterPart)

    Gets an item with the specified master part.

    Declaration
    public Item GetItem(Item.MasterPart masterPart)
    Parameters
    Type Name Description
    Item.MasterPart masterPart

    The master part of the item to retrieve.

    Returns
    Type Description
    Item

    The item with the specified master part, or null if no item is found.

    GetItemAsync(string, CancellationToken)

    Retrieves an item by its IdMaster.

    Declaration
    public Task<Item> GetItemAsync(string itemIdMaster, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to retrieve.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<Item>

    The item with the specified IdMaster, or null if no item is found.

    GetItemPreviewCountAsync(string, IEnumerable<Section>, Navigation, CancellationToken)

    Gets the preview count of an item.

    Declaration
    public Task<long> GetItemPreviewCountAsync(string itemIdMaster, IEnumerable<Section> elementSections, Navigation navigation, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The id of the item.

    IEnumerable<Section> elementSections

    The Section objects of the element.

    Navigation navigation

    The Navigation settings.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<long>

    The preview count of the item.

    GetItemVersionAsync(string, Section, VersionFilter, CancellationToken)

    Gets the versions of an item.

    Declaration
    public Task<ItemVersion> GetItemVersionAsync(string itemIdMaster, Section section, VersionFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The id of the item.

    Section section

    The Section.

    VersionFilter filter

    The VersionFilter used to retrive versions.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<ItemVersion>

    The version of the item.

    GetItemVersionsAsync(string, Section, VersionFilter, CancellationToken)

    Gets the versions of an item.

    Declaration
    public Task<IEnumerable<ItemVersion>> GetItemVersionsAsync(string itemIdMaster, Section section, VersionFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The id of the item.

    Section section

    The Section.

    VersionFilter filter

    The VersionFilter used to retrive versions.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IEnumerable<ItemVersion>>

    The versions of the item.

    GetNewHistoryVersionNameAsync(string, string, Section, CancellationToken)

    Gets a new version name for a given item and section.

    Declaration
    public Task<string> GetNewHistoryVersionNameAsync(string itemIdMaster, string parentVersionName, Section section, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The IdMaster of the item.

    string parentVersionName

    The parent version name.

    Section section

    The Section of the item.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<string>

    A new history version name.

    GetNewItemAsync(CancellationToken)

    Creates a new item with default values.

    Declaration
    public Task<Item> GetNewItemAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<Item>

    A new item.

    GetNewVersionNameAsync(string, Section, CancellationToken)

    Gets a new version name for an item.

    Declaration
    public Task<string> GetNewVersionNameAsync(string itemIdMaster, Section section, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The id of the item.

    Section section

    The Section.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<string>

    The new version name.

    GetParentVersionName(string)

    Gets the parent version name for a given history version name.

    Declaration
    public string GetParentVersionName(string historyVersionName)
    Parameters
    Type Name Description
    string historyVersionName

    The history version name.

    Returns
    Type Description
    string

    The parent version name.

    GetRelationCountAsync(string, CancellationToken)

    Gets the number of relations for the specified item.

    Declaration
    public Task<long> GetRelationCountAsync(string itemIdMaster, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to get the relation count for.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<long>

    A task representing the asynchronous operation.

    GetRelationsAsync(string, CancellationToken)

    Gets the relations for the specified item.

    Declaration
    public Task<IEnumerable<Relation>> GetRelationsAsync(string itemIdMaster, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to get the relations for.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IEnumerable<Relation>>

    A task representing the asynchronous operation.

    GetVersionLocalizationsAsync(string, Section, CancellationToken)

    Gets the localizations of a version.

    Declaration
    public Task<IEnumerable<string>> GetVersionLocalizationsAsync(string itemIdMaster, Section section, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The id of the item.

    Section section

    The Section.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IEnumerable<string>>

    The localizations of the version.

    IsHistoryRateLimitAsync(string, string, Section, CancellationToken)

    Gets the localizations of a version.

    Declaration
    public Task<bool> IsHistoryRateLimitAsync(string itemIdMaster, string versionName, Section section, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The id of the item.

    string versionName

    The parent version name of the item.

    Section section

    The Section.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<bool>

    The localizations of the version.

    IsVersionStatusAvailable(ItemVersion, IEnumerable<ItemVersion>, VersionStatus)

    Determines if a version status is available for an item.

    Declaration
    public bool IsVersionStatusAvailable(ItemVersion version, IEnumerable<ItemVersion> versions, VersionStatus providedStatus)
    Parameters
    Type Name Description
    ItemVersion version

    The current ItemVersion.

    IEnumerable<ItemVersion> versions

    The ItemVersion objects of the item.

    VersionStatus providedStatus

    The provided VersionStatus.

    Returns
    Type Description
    bool

    True if the status is available, otherwise false.

    RelationExistsAsync(string, string, string, CancellationToken)

    Checks if a relation between two items exists.

    Declaration
    public Task<bool> RelationExistsAsync(string itemIdMaster, string parentIdMaster, string sectionName, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to check for relation.

    string parentIdMaster

    The Id of the parent item to check for relation.

    string sectionName

    The name of the section to check for relation.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<bool>

    A Task representing the asynchronous operation, which when completed will return a bool indicating whether a relation exists between the two items.

    RelationMoveAsync(string, string, RelationMoveMode, string, string, int, CancellationToken)

    Moves the relation for the specified item and parent item in the specified section to the specified target item.

    Declaration
    public Task RelationMoveAsync(string itemIdMaster, string targetIdMaster, RelationMoveMode Mode, string parentIdMaster, string sectionName, int movingItemsCount, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to move the relation from.

    string targetIdMaster

    The Id of the target item to move the relation to.

    RelationMoveMode Mode

    The RelationMoveMode for the relation.

    string parentIdMaster

    The Id of the parent item to move the relation from.

    string sectionName

    The name of the section to move the relation from.

    int movingItemsCount

    The number of items to move.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task representing the asynchronous operation.

    RelationRemoveAsync(string, string, string, CancellationToken)

    Removes the relation for the specified item and parent item in the specified section.

    Declaration
    public Task RelationRemoveAsync(string itemIdMaster, string parentIdMaster, string sectionName, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to remove the relation from.

    string parentIdMaster

    The Id of the parent item to remove the relation from.

    string sectionName

    The name of the section to remove the relation from.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task representing the asynchronous operation.

    RelationSaveAsync(string, string, string, CancellationToken)

    Saves a relation between two items.

    Declaration
    public Task RelationSaveAsync(string itemIdMaster, string parentIdMaster, string sectionName, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to save relation for.

    string parentIdMaster

    The Id of the parent item to save relation for.

    string sectionName

    The name of the section to save relation for.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    SetHistoryVersionAsync(Item, Section, string, string, Dictionary<string, object>, CancellationToken)

    Sets a new history version for the item.

    Declaration
    public Task<string> SetHistoryVersionAsync(Item item, Section section, string versionName, string versionCulture, Dictionary<string, object> sectionData, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Item item

    The Item of the item.

    Section section

    The Section of the item.

    string versionName

    The parent version name of the item.

    string versionCulture

    The parent version culture of the item.

    Dictionary<string, object> sectionData

    The parent data.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<string>

    The history version name.

    SetStatusAsync(string, ItemStatus, CancellationToken)

    Sets the status of an item with the specified IdMaster.

    Declaration
    public Task SetStatusAsync(string itemIdMaster, ItemStatus status, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item to update.

    ItemStatus status

    The new ItemStatus of the item.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task representing the asynchronous operation.

    SetVersionLinkedValuesAsync(string, Section, string, Dictionary<string, object>, CancellationToken)

    Sets the linked values of the specified item version.

    Declaration
    public Task SetVersionLinkedValuesAsync(string itemIdMaster, Section section, string versionName, Dictionary<string, object> linkedValues, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item.

    Section section

    The Section of the item.

    string versionName

    The name of the version to update.

    Dictionary<string, object> linkedValues

    The linked values to set for the version.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task that represents the asynchronous operation.

    SetVersionStatusAndCultureAsync(string, Section, string, string, VersionStatus, IEnumerable<string>, CancellationToken)

    Sets the status and culture of the specified item version.

    Declaration
    public Task<VersionUpdateResult> SetVersionStatusAndCultureAsync(string itemIdMaster, Section section, string versionName, string versionCulture, VersionStatus versionStatus, IEnumerable<string> cultures, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string itemIdMaster

    The Id of the item.

    Section section

    The Section of the item.

    string versionName

    The name of the version to update.

    string versionCulture

    The culture of the version to update.

    VersionStatus versionStatus

    The VersionStatus to set for the version.

    IEnumerable<string> cultures

    The cultures to update.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<VersionUpdateResult>

    The result of the operation.

    Implements

    IItemService
    In this article
    Back to top Generated by DocFX