Interface IDictionaryItemService
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IDictionaryItemService
Methods
View SourceCountChildrenAsync(Guid)
Declaration
Task<int> CountChildrenAsync(Guid parentId)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | parentId |
Returns
| Type | Description |
|---|---|
| Task<int> |
CountRootAsync()
Declaration
Task<int> CountRootAsync()
Returns
| Type | Description |
|---|---|
| Task<int> |
CreateAsync(IDictionaryItem, Guid)
Creates and saves a new dictionary item and assigns translations to all applicable languages if specified
Declaration
Task<Attempt<IDictionaryItem, DictionaryItemOperationStatus>> CreateAsync(IDictionaryItem dictionaryItem, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| IDictionaryItem | dictionaryItem | IDictionaryItem to create |
| Guid | userKey | Key of the user saving the dictionary item |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IDictionaryItem, DictionaryItemOperationStatus>> |
DeleteAsync(Guid, Guid)
Deletes a IDictionaryItem object and its related translations as well as its children.
Declaration
Task<Attempt<IDictionaryItem?, DictionaryItemOperationStatus>> DeleteAsync(Guid id, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | The ID of the IDictionaryItem to delete |
| Guid | userKey | Key of the user deleting the dictionary item |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IDictionaryItem, DictionaryItemOperationStatus>> |
ExistsAsync(string)
Checks if a IDictionaryItem with given key exists
Declaration
Task<bool> ExistsAsync(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | Key of the IDictionaryItem |
Returns
| Type | Description |
|---|---|
| Task<bool> | True if a IDictionaryItem exists, otherwise false |
GetAsync(Guid)
Gets a IDictionaryItem by its System.Guid id
Declaration
Task<IDictionaryItem?> GetAsync(Guid id)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | Id of the IDictionaryItem |
Returns
| Type | Description |
|---|---|
| Task<IDictionaryItem> |
GetAsync(string)
Gets a IDictionaryItem by by its key
Declaration
Task<IDictionaryItem?> GetAsync(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | Key of the IDictionaryItem |
Returns
| Type | Description |
|---|---|
| Task<IDictionaryItem> |
GetAtRootAsync()
Gets the root/top IDictionaryItem objects
Declaration
Task<IEnumerable<IDictionaryItem>> GetAtRootAsync()
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<IDictionaryItem>> | An enumerable list of IDictionaryItem objects |
GetChildrenAsync(Guid)
Gets a list of children for a IDictionaryItem
Declaration
Task<IEnumerable<IDictionaryItem>> GetChildrenAsync(Guid parentId)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | parentId | Id of the parent |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<IDictionaryItem>> | An enumerable list of IDictionaryItem objects |
GetDescendantsAsync(Guid?, string?)
Gets a list of descendants for a IDictionaryItem
Declaration
Task<IEnumerable<IDictionaryItem>> GetDescendantsAsync(Guid? parentId, string? filter = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid? | parentId | Id of the parent, null will return all dictionary items |
| string | filter | An optional filter, which will limit the results to only those dictionary items whose key starts with the filter value. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<IDictionaryItem>> | An enumerable list of IDictionaryItem objects |
GetManyAsync(params Guid[])
Gets a collection of IDictionaryItem by their System.Guid ids
Declaration
Task<IEnumerable<IDictionaryItem>> GetManyAsync(params Guid[] ids)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid[] | ids | Ids of the IDictionaryItem |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<IDictionaryItem>> | A collection of IDictionaryItem |
GetManyAsync(params string[])
Gets a collection of IDictionaryItem by their keys
Declaration
Task<IEnumerable<IDictionaryItem>> GetManyAsync(params string[] keys)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | keys | Keys of the IDictionaryItem |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<IDictionaryItem>> | A collection of IDictionaryItem |
GetPagedAsync(Guid?, int, int)
Gets the dictionary items in a paged manner. Currently implements the paging in memory on the itenkey property because the underlying repository does not support paging yet
Declaration
Task<PagedModel<IDictionaryItem>> GetPagedAsync(Guid? parentId, int skip, int take)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid? | parentId | |
| int | skip | |
| int | take |
Returns
| Type | Description |
|---|---|
| Task<PagedModel<IDictionaryItem>> |
MoveAsync(IDictionaryItem, Guid?, Guid)
Moves a IDictionaryItem object
Declaration
Task<Attempt<IDictionaryItem, DictionaryItemOperationStatus>> MoveAsync(IDictionaryItem dictionaryItem, Guid? parentId, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| IDictionaryItem | dictionaryItem | IDictionaryItem to move |
| Guid? | parentId | Id of the new IDictionaryItem parent, null if the item should be moved to the root |
| Guid | userKey | Key of the user moving the dictionary item |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IDictionaryItem, DictionaryItemOperationStatus>> |
UpdateAsync(IDictionaryItem, Guid)
Updates an existing IDictionaryItem object
Declaration
Task<Attempt<IDictionaryItem, DictionaryItemOperationStatus>> UpdateAsync(IDictionaryItem dictionaryItem, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| IDictionaryItem | dictionaryItem | IDictionaryItem to update |
| Guid | userKey | Key of the user saving the dictionary item |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IDictionaryItem, DictionaryItemOperationStatus>> |