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 SourceCopy(IDataType, int)
Declaration
[Obsolete("Please use CopyASync instead. Will be removed in V15")]
Attempt<OperationResult<MoveOperationStatusType, IDataType>?> Copy(IDataType copying, int containerId)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataType | copying | |
| int | containerId |
Returns
| Type | Description |
|---|---|
| Attempt<OperationResult<MoveOperationStatusType, IDataType>> |
Copy(IDataType, int, int)
Declaration
[Obsolete("Please use CopyASync instead. Will be removed in V15")]
Attempt<OperationResult<MoveOperationStatusType, IDataType>?> Copy(IDataType copying, int containerId, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataType | copying | |
| int | containerId | |
| int | userId |
Returns
| Type | Description |
|---|---|
| Attempt<OperationResult<MoveOperationStatusType, IDataType>> |
CopyAsync(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>> |
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>> |
CreateContainer(int, Guid, string, int)
Declaration
[Obsolete("Please use IDataTypeContainerService for all data type container operations. Will be removed in V15.")]
Attempt<OperationResult<OperationResultType, EntityContainer>?> CreateContainer(int parentId, Guid key, string name, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parentId | |
| Guid | key | |
| string | name | |
| int | userId |
Returns
| Type | Description |
|---|---|
| Attempt<OperationResult<OperationResultType, EntityContainer>> |
Delete(IDataType, int)
Deletes an IDataType
Declaration
[Obsolete("Please use DeleteAsync. Will be removed in V15.")]
void Delete(IDataType dataType, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataType | dataType | IDataType to delete |
| int | userId | Id of the user issuing the deletion |
Remarks
Please note that deleting a IDataType will remove all the IPropertyType data that references this IDataType.
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.
DeleteContainer(int, int)
Declaration
[Obsolete("Please use IDataTypeContainerService for all data type container operations. Will be removed in V15.")]
Attempt<OperationResult?> DeleteContainer(int containerId, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| int | containerId | |
| int | userId |
Returns
| Type | Description |
|---|---|
| Attempt<OperationResult> |
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. |
GetAll(params int[])
Gets all IDataType objects or those with the ids passed in
Declaration
[Obsolete("Please use GetAllAsync. Will be removed in V15.")]
IEnumerable<IDataType> GetAll(params int[] ids)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | ids | Optional array of Ids |
Returns
| Type | Description |
|---|---|
| IEnumerable<IDataType> | An enumerable list of IDataType objects |
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> |
GetByEditorAlias(string)
Gets a IDataType by its control Id
Declaration
[Obsolete("Please use GetByEditorAliasAsync. Will be removed in V15.")]
IEnumerable<IDataType> GetByEditorAlias(string propertyEditorAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | propertyEditorAlias | Alias of the property editor |
Returns
| Type | Description |
|---|---|
| IEnumerable<IDataType> | Collection of IDataType objects with a matching control id |
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. |
GetContainer(Guid)
Declaration
[Obsolete("Please use IDataTypeContainerService for all data type container operations. Will be removed in V15.")]
EntityContainer? GetContainer(Guid containerId)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | containerId |
Returns
| Type | Description |
|---|---|
| EntityContainer |
GetContainer(int)
Declaration
[Obsolete("Please use IDataTypeContainerService for all data type container operations. Will be removed in V15.")]
EntityContainer? GetContainer(int containerId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | containerId |
Returns
| Type | Description |
|---|---|
| EntityContainer |
GetContainers(int[])
Declaration
[Obsolete("Please use IDataTypeContainerService for all data type container operations. Will be removed in V15.")]
IEnumerable<EntityContainer> GetContainers(int[] containerIds)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | containerIds |
Returns
| Type | Description |
|---|---|
| IEnumerable<EntityContainer> |
GetContainers(string, int)
Declaration
[Obsolete("Please use IDataTypeContainerService for all data type container operations. Will be removed in V15.")]
IEnumerable<EntityContainer> GetContainers(string folderName, int level)
Parameters
| Type | Name | Description |
|---|---|---|
| string | folderName | |
| int | level |
Returns
| Type | Description |
|---|---|
| IEnumerable<EntityContainer> |
GetContainers(IDataType)
Declaration
[Obsolete("Please use IDataTypeContainerService for all data type container operations. Will be removed in V15.")]
IEnumerable<EntityContainer> GetContainers(IDataType dataType)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataType | dataType |
Returns
| Type | Description |
|---|---|
| IEnumerable<EntityContainer> |
GetDataType(int)
Gets a IDataType by its Id
Declaration
[Obsolete("Please use GetAsync. Will be removed in V15.")]
IDataType? GetDataType(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Id of the IDataType |
Returns
| Type | Description |
|---|---|
| IDataType |
GetDataType(string)
Gets a IDataType by its Name
Declaration
[Obsolete("Please use GetAsync. Will be removed in V15.")]
IDataType? GetDataType(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Name of the IDataType |
Returns
| Type | Description |
|---|---|
| IDataType |
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.
Move(IDataType, int)
Declaration
[Obsolete("Please use MoveAsync instead. Will be removed in V15")]
Attempt<OperationResult<MoveOperationStatusType>?> Move(IDataType toMove, int parentId)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataType | toMove | |
| int | parentId |
Returns
| Type | Description |
|---|---|
| Attempt<OperationResult<MoveOperationStatusType>> |
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>> |
RenameContainer(int, string, int)
Declaration
[Obsolete("Please use IDataTypeContainerService for all data type container operations. Will be removed in V15.")]
Attempt<OperationResult<OperationResultType, EntityContainer>?> RenameContainer(int id, string name, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | |
| string | name | |
| int | userId |
Returns
| Type | Description |
|---|---|
| Attempt<OperationResult<OperationResultType, EntityContainer>> |
Save(IEnumerable<IDataType>, int)
Saves a collection of IDataType
Declaration
[Obsolete("Please use CreateAsync or UpdateAsync. Will be removed in V15.")]
void Save(IEnumerable<IDataType> dataTypeDefinitions, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IDataType> | dataTypeDefinitions | IDataType to save |
| int | userId | Id of the user issuing the save |
Save(IDataType, int)
Saves an IDataType
Declaration
[Obsolete("Please use CreateAsync or UpdateAsync. Will be removed in V15.")]
void Save(IDataType dataType, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataType | dataType | IDataType to save |
| int | userId | Id of the user issuing the save |
SaveContainer(EntityContainer, int)
Declaration
[Obsolete("Please use IDataTypeContainerService for all data type container operations. Will be removed in V15.")]
Attempt<OperationResult?> SaveContainer(EntityContainer container, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityContainer | container | |
| int | userId |
Returns
| Type | Description |
|---|---|
| Attempt<OperationResult> |
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. |