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 : IServiceMethods
View SourceCopy(IDataType, Int32)
Declaration
virtual Attempt<OperationResult<MoveOperationStatusType, IDataType>> Copy(IDataType copying, int containerId)Parameters
| Type | Name | Description | 
|---|---|---|
| IDataType | copying | |
| System.Int32 | containerId | 
Returns
| Type | Description | 
|---|---|
| Attempt<OperationResult<MoveOperationStatusType, IDataType>> | 
Copy(IDataType, Int32, Int32)
Declaration
virtual Attempt<OperationResult<MoveOperationStatusType, IDataType>> Copy(IDataType copying, int containerId, int userId = -1)Parameters
| Type | Name | Description | 
|---|---|---|
| IDataType | copying | |
| System.Int32 | containerId | |
| System.Int32 | userId | 
Returns
| Type | Description | 
|---|---|
| Attempt<OperationResult<MoveOperationStatusType, IDataType>> | 
CopyAsync(IDataType, Nullable<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 | 
| System.Nullable<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(Int32, Guid, String, Int32)
Declaration
Attempt<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentId, Guid key, string name, int userId = -1)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | parentId | |
| Guid | key | |
| System.String | name | |
| System.Int32 | userId | 
Returns
| Type | Description | 
|---|---|
| Attempt<OperationResult<OperationResultType, EntityContainer>> | 
Delete(IDataType, Int32)
Deletes an IDataType
Declaration
void Delete(IDataType dataType, int userId = -1)Parameters
| Type | Name | Description | 
|---|---|---|
| IDataType | dataType | IDataType to delete | 
| System.Int32 | 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(Int32, Int32)
Declaration
Attempt<OperationResult> DeleteContainer(int containerId, int userId = -1)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | containerId | |
| System.Int32 | userId | 
Returns
| Type | Description | 
|---|---|
| Attempt<OperationResult> | 
FilterAsync(String, String, String, Int32, Int32)
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 | 
|---|---|---|
| System.String | name | Name to filter by. | 
| System.String | editorUiAlias | Editor ui alias to filter by. | 
| System.String | editorAlias | Editor alias to filter by. | 
| System.Int32 | skip | Number of items to skip. | 
| System.Int32 | take | Number of items to take. | 
Returns
| Type | Description | 
|---|---|
| Task<PagedModel<IDataType>> | An attempt with the requested data types. | 
GetAll(Int32[])
Gets all IDataType objects or those with the ids passed in
Declaration
IEnumerable<IDataType> GetAll(params int[] ids)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32[] | ids | Optional array of Ids | 
Returns
| Type | Description | 
|---|---|
| IEnumerable<IDataType> | An enumerable list of IDataType objects | 
GetAllAsync(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> | IDataType | 
GetAsync(String)
Gets an IDataType by its Name
Declaration
Task<IDataType> GetAsync(string name)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | name | Name of the IDataType | 
Returns
| Type | Description | 
|---|---|
| Task<IDataType> | IDataType | 
GetByEditorAlias(String)
Gets a IDataType by its control Id
Declaration
IEnumerable<IDataType> GetByEditorAlias(string propertyEditorAlias)Parameters
| Type | Name | Description | 
|---|---|---|
| System.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
virtual Task<IEnumerable<IDataType>> GetByEditorAliasAsync(string propertyEditorAlias)Parameters
| Type | Name | Description | 
|---|---|---|
| System.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
virtual Task<IEnumerable<IDataType>> GetByEditorAliasAsync(string[] propertyEditorAlias)Parameters
| Type | Name | Description | 
|---|---|---|
| System.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 | 
|---|---|---|
| System.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
EntityContainer GetContainer(Guid containerId)Parameters
| Type | Name | Description | 
|---|---|---|
| Guid | containerId | 
Returns
| Type | Description | 
|---|---|
| EntityContainer | 
GetContainer(Int32)
Declaration
EntityContainer GetContainer(int containerId)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | containerId | 
Returns
| Type | Description | 
|---|---|
| EntityContainer | 
GetContainers(Int32[])
Declaration
IEnumerable<EntityContainer> GetContainers(int[] containerIds)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32[] | containerIds | 
Returns
| Type | Description | 
|---|---|
| IEnumerable<EntityContainer> | 
GetContainers(String, Int32)
Declaration
IEnumerable<EntityContainer> GetContainers(string folderName, int level)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | folderName | |
| System.Int32 | level | 
Returns
| Type | Description | 
|---|---|
| IEnumerable<EntityContainer> | 
GetContainers(IDataType)
Declaration
IEnumerable<EntityContainer> GetContainers(IDataType dataType)Parameters
| Type | Name | Description | 
|---|---|---|
| IDataType | dataType | 
Returns
| Type | Description | 
|---|---|
| IEnumerable<EntityContainer> | 
GetDataType(Int32)
Gets a IDataType by its Id
Declaration
IDataType GetDataType(int id)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | id | Id of the IDataType | 
Returns
| Type | Description | 
|---|---|
| IDataType | IDataType | 
GetDataType(String)
Gets a IDataType by its Name
Declaration
IDataType GetDataType(string name)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | name | Name of the IDataType | 
Returns
| Type | Description | 
|---|---|
| IDataType | IDataType | 
GetListViewReferences(Int32)
Declaration
virtual IReadOnlyDictionary<Udi, IEnumerable<string>> GetListViewReferences(int id)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | id | 
Returns
| Type | Description | 
|---|---|
| IReadOnlyDictionary<Udi, IEnumerable<System.String>> | 
GetPagedRelationsAsync(Guid, Int32, Int32)
Gets a paged result of items which are in relation with the current data type.
Declaration
virtual 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. | 
| System.Int32 | skip | The amount of items to skip | 
| System.Int32 | 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.
GetReferencesAsync(Guid)
Declaration
Task<Attempt<IReadOnlyDictionary<Udi, IEnumerable<string>>, DataTypeOperationStatus>> GetReferencesAsync(Guid id)Parameters
| Type | Name | Description | 
|---|---|---|
| Guid | id | The guid Id of the IDataType | 
Returns
| Type | Description | 
|---|---|
| Task<Attempt<IReadOnlyDictionary<Udi, IEnumerable<System.String>>, DataTypeOperationStatus>> | 
Move(IDataType, Int32)
Declaration
Attempt<OperationResult<MoveOperationStatusType>> Move(IDataType toMove, int parentId)Parameters
| Type | Name | Description | 
|---|---|---|
| IDataType | toMove | |
| System.Int32 | parentId | 
Returns
| Type | Description | 
|---|---|
| Attempt<OperationResult<MoveOperationStatusType>> | 
MoveAsync(IDataType, Nullable<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 | 
| System.Nullable<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(Int32, String, Int32)
Declaration
Attempt<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = -1)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | id | |
| System.String | name | |
| System.Int32 | userId | 
Returns
| Type | Description | 
|---|---|
| Attempt<OperationResult<OperationResultType, EntityContainer>> | 
Save(IEnumerable<IDataType>, Int32)
Saves a collection of IDataType
Declaration
void Save(IEnumerable<IDataType> dataTypeDefinitions, int userId = -1)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerable<IDataType> | dataTypeDefinitions | IDataType to save | 
| System.Int32 | userId | Id of the user issuing the save | 
Save(IDataType, Int32)
Saves an IDataType
Declaration
void Save(IDataType dataType, int userId = -1)Parameters
| Type | Name | Description | 
|---|---|---|
| IDataType | dataType | IDataType to save | 
| System.Int32 | userId | Id of the user issuing the save | 
SaveContainer(EntityContainer, Int32)
Declaration
Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = -1)Parameters
| Type | Name | Description | 
|---|---|---|
| EntityContainer | container | |
| System.Int32 | 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<System.ComponentModel.DataAnnotations.ValidationResult> | One or more System.ComponentModel.DataAnnotations.ValidationResult if the configuration data is invalid, an empty collection otherwise. |