Interface IDataTypeService
Defines the DataType Service, which is an easy access to operations involving IDataType
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IDataTypeService : IService
Methods
View SourceCopyAsync(IDataType, Guid?, Guid)
Copies a IDataType to a given container
Declaration
Task<Attempt<IDataType, DataTypeOperationStatus>> CopyAsync(IDataType toCopy, Guid? containerKey, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataType | toCopy | The data type that will be copied |
| Guid? | containerKey | The container key where the data type will be copied to. |
| Guid | userKey | The user that did the Copy action |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IDataType, DataTypeOperationStatus>> | An attempt result with the copied data type and operation status. |
CreateAsync(IDataType, Guid)
Creates a new IDataType
Declaration
Task<Attempt<IDataType, DataTypeOperationStatus>> CreateAsync(IDataType dataType, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataType | dataType | IDataType to create |
| Guid | userKey | Key of the user issuing the creation |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IDataType, DataTypeOperationStatus>> |
DeleteAsync(Guid, Guid)
Deletes an IDataType
Declaration
Task<Attempt<IDataType?, DataTypeOperationStatus>> DeleteAsync(Guid id, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | The guid Id of the IDataType to delete |
| Guid | userKey | Key of the user issuing the deletion |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IDataType, DataTypeOperationStatus>> |
Remarks
Please note that deleting a IDataType will remove all the IPropertyType data that references this IDataType.
FilterAsync(string?, string?, string?, int, int)
Gets multiple IDataType objects by their unique keys.
Declaration
Task<PagedModel<IDataType>> FilterAsync(string? name = null, string? editorUiAlias = null, string? editorAlias = null, int skip = 0, int take = 100)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Name to filter by. |
| string | editorUiAlias | Editor ui alias to filter by. |
| string | editorAlias | Editor alias to filter by. |
| int | skip | Number of items to skip. |
| int | take | Number of items to take. |
Returns
| Type | Description |
|---|---|
| Task<PagedModel<IDataType>> | An attempt with the requested data types. |
GetAllAsync(params Guid[])
Gets multiple IDataType objects by their unique keys.
Declaration
Task<IEnumerable<IDataType>> GetAllAsync(params Guid[] keys)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid[] | keys | The keys to get datatypes by. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<IDataType>> | An attempt with the requested data types. |
GetAsync(Guid)
Gets an IDataType by its unique guid Id
Declaration
Task<IDataType?> GetAsync(Guid id)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | Unique guid Id of the DataType |
Returns
| Type | Description |
|---|---|
| Task<IDataType> |
GetAsync(string)
Gets an IDataType by its Name
Declaration
Task<IDataType?> GetAsync(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Name of the IDataType |
Returns
| Type | Description |
|---|---|
| Task<IDataType> |
GetByEditorAliasAsync(string)
Gets all IDataType for a given property editor.
Declaration
Task<IEnumerable<IDataType>> GetByEditorAliasAsync(string propertyEditorAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | propertyEditorAlias | Alias of the property editor. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<IDataType>> | Collection of IDataType configured for the property editor. |
GetByEditorAliasAsync(string[])
Gets all IDataType for a set of property editors.
Declaration
Task<IEnumerable<IDataType>> GetByEditorAliasAsync(string[] propertyEditorAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | propertyEditorAlias | Aliases of the property editors. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<IDataType>> | Collection of IDataType configured for the property editors. |
GetByEditorUiAlias(string)
Gets all IDataType for a given editor UI alias.
Declaration
Task<IEnumerable<IDataType>> GetByEditorUiAlias(string editorUiAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | editorUiAlias | The UI Alias to query by. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<IDataType>> | Collection of IDataType which has the UI alias. |
GetPagedRelationsAsync(Guid, int, int)
Gets a paged result of items which are in relation with the current data type.
Declaration
Task<PagedModel<RelationItemModel>> GetPagedRelationsAsync(Guid key, int skip, int take)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The identifier of the data type to retrieve relations for. |
| int | skip | The amount of items to skip |
| int | take | The amount of items to take. |
Returns
| Type | Description |
|---|---|
| Task<PagedModel<RelationItemModel>> | A paged result of RelationItemModel objects. |
Remarks
Note that the model and method signature here aligns with with how we handle retrieval of concrete Umbraco relations based on documents, media and members in ITrackedReferencesService. The intention is that we align data type relations with these so they can be handled polymorphically at the management API and backoffice UI level.
MoveAsync(IDataType, Guid?, Guid)
Moves a IDataType to a given container
Declaration
Task<Attempt<IDataType, DataTypeOperationStatus>> MoveAsync(IDataType toMove, Guid? containerKey, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataType | toMove | The data type that will be moved |
| Guid? | containerKey | The container key where the data type will be moved to. |
| Guid | userKey | The user that did the Move action |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IDataType, DataTypeOperationStatus>> | An attempt result with the moved data type and operation status. |
UpdateAsync(IDataType, Guid)
Updates an existing IDataType
Declaration
Task<Attempt<IDataType, DataTypeOperationStatus>> UpdateAsync(IDataType dataType, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataType | dataType | IDataType to update |
| Guid | userKey | Key of the user issuing the update |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IDataType, DataTypeOperationStatus>> |
ValidateConfigurationData(IDataType)
Performs validation for the configuration data of a given data type.
Declaration
IEnumerable<ValidationResult> ValidateConfigurationData(IDataType dataType)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataType | dataType | The data type whose configuration to validate. |
Returns
| Type | Description |
|---|---|
| IEnumerable<ValidationResult> | One or more System.ComponentModel.DataAnnotations.ValidationResult if the configuration data is invalid, an empty collection otherwise. |