Interface IDataTypeService
Defines the DataType Service, which is an easy access to operations involving IData
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IDataTypeService : IService
Methods
View SourceCopy(IDataType, Int32)
Declaration
virtual Attempt<OperationResult<MoveOperationStatusType, IDataType>> Copy(IDataType copying, int containerId)
Parameters
Type | Name | Description |
---|---|---|
IData |
copying | |
System. |
containerId |
Returns
Type | Description |
---|---|
Attempt<Operation |
Copy(IDataType, Int32, Int32)
Declaration
virtual Attempt<OperationResult<MoveOperationStatusType, IDataType>> Copy(IDataType copying, int containerId, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
IData |
copying | |
System. |
containerId | |
System. |
userId |
Returns
Type | Description |
---|---|
Attempt<Operation |
CopyAsync(IDataType, Nullable<Guid>, Guid)
Copies a IData
Declaration
Task<Attempt<IDataType, DataTypeOperationStatus>> CopyAsync(IDataType toCopy, Guid? containerKey, Guid userKey)
Parameters
Type | Name | Description |
---|---|---|
IData |
toCopy | The data type that will be copied |
System. |
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<IData |
CreateAsync(IDataType, Guid)
Creates a new IData
Declaration
Task<Attempt<IDataType, DataTypeOperationStatus>> CreateAsync(IDataType dataType, Guid userKey)
Parameters
Type | Name | Description |
---|---|---|
IData |
dataType | IData |
Guid | userKey | Key of the user issuing the creation |
Returns
Type | Description |
---|---|
Task<Attempt<IData |
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. |
parentId | |
Guid | key | |
System. |
name | |
System. |
userId |
Returns
Type | Description |
---|---|
Attempt<Operation |
Delete(IDataType, Int32)
Deletes an IData
Declaration
void Delete(IDataType dataType, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
IData |
dataType | IData |
System. |
userId | Id of the user issuing the deletion |
Remarks
Please note that deleting a IData
DeleteAsync(Guid, Guid)
Deletes an IData
Declaration
Task<Attempt<IDataType, DataTypeOperationStatus>> DeleteAsync(Guid id, Guid userKey)
Parameters
Type | Name | Description |
---|---|---|
Guid | id | The guid Id of the IData |
Guid | userKey | Key of the user issuing the deletion |
Returns
Type | Description |
---|---|
Task<Attempt<IData |
Remarks
Please note that deleting a IData
DeleteContainer(Int32, Int32)
Declaration
Attempt<OperationResult> DeleteContainer(int containerId, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
System. |
containerId | |
System. |
userId |
Returns
Type | Description |
---|---|
Attempt<Operation |
FilterAsync(String, String, String, Int32, Int32)
Gets multiple IData
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. |
name | Name to filter by. |
System. |
editorUiAlias | Editor ui alias to filter by. |
System. |
editorAlias | Editor alias to filter by. |
System. |
skip | Number of items to skip. |
System. |
take | Number of items to take. |
Returns
Type | Description |
---|---|
Task<Paged |
An attempt with the requested data types. |
GetAll(Int32[])
Gets all IData
Declaration
IEnumerable<IDataType> GetAll(params int[] ids)
Parameters
Type | Name | Description |
---|---|---|
System. |
ids | Optional array of Ids |
Returns
View SourceGetAllAsync(Guid[])
Gets multiple IData
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<IData |
An attempt with the requested data types. |
GetAsync(Guid)
Gets an IData
Declaration
Task<IDataType> GetAsync(Guid id)
Parameters
Type | Name | Description |
---|---|---|
Guid | id | Unique guid Id of the DataType |
Returns
View SourceGetAsync(String)
Gets an IData
Declaration
Task<IDataType> GetAsync(string name)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | Name of the IData |
Returns
View SourceGetByEditorAlias(String)
Gets a IData
Declaration
IEnumerable<IDataType> GetByEditorAlias(string propertyEditorAlias)
Parameters
Type | Name | Description |
---|---|---|
System. |
propertyEditorAlias | Alias of the property editor |
Returns
View SourceGetByEditorAliasAsync(String)
Gets all IData
Declaration
virtual Task<IEnumerable<IDataType>> GetByEditorAliasAsync(string propertyEditorAlias)
Parameters
Type | Name | Description |
---|---|---|
System. |
propertyEditorAlias | Alias of the property editor |
Returns
Type | Description |
---|---|
Task<IEnumerable<IData |
Collection of IData |
GetByEditorAliasAsync(String[])
Gets all IData
Declaration
virtual Task<IEnumerable<IDataType>> GetByEditorAliasAsync(string[] propertyEditorAlias)
Parameters
Type | Name | Description |
---|---|---|
System. |
propertyEditorAlias | Aliases of the property editors |
Returns
Type | Description |
---|---|
Task<IEnumerable<IData |
Collection of IData |
GetByEditorUiAlias(String)
Gets all IData
Declaration
Task<IEnumerable<IDataType>> GetByEditorUiAlias(string editorUiAlias)
Parameters
Type | Name | Description |
---|---|---|
System. |
editorUiAlias | The UI Alias to query by. |
Returns
View SourceGetContainer(Guid)
Declaration
EntityContainer GetContainer(Guid containerId)
Parameters
Type | Name | Description |
---|---|---|
Guid | containerId |
Returns
Type | Description |
---|---|
Entity |
GetContainer(Int32)
Declaration
EntityContainer GetContainer(int containerId)
Parameters
Type | Name | Description |
---|---|---|
System. |
containerId |
Returns
Type | Description |
---|---|
Entity |
GetContainers(Int32[])
Declaration
IEnumerable<EntityContainer> GetContainers(int[] containerIds)
Parameters
Type | Name | Description |
---|---|---|
System. |
containerIds |
Returns
Type | Description |
---|---|
IEnumerable<Entity |
GetContainers(String, Int32)
Declaration
IEnumerable<EntityContainer> GetContainers(string folderName, int level)
Parameters
Type | Name | Description |
---|---|---|
System. |
folderName | |
System. |
level |
Returns
Type | Description |
---|---|
IEnumerable<Entity |
GetContainers(IDataType)
Declaration
IEnumerable<EntityContainer> GetContainers(IDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
IData |
dataType |
Returns
Type | Description |
---|---|
IEnumerable<Entity |
GetDataType(Int32)
Gets a IData
Declaration
IDataType GetDataType(int id)
Parameters
Type | Name | Description |
---|---|---|
System. |
id | Id of the IData |
Returns
View SourceGetDataType(String)
Gets a IData
Declaration
IDataType GetDataType(string name)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | Name of the IData |
Returns
View SourceGetListViewReferences(Int32)
Declaration
virtual IReadOnlyDictionary<Udi, IEnumerable<string>> GetListViewReferences(int id)
Parameters
Type | Name | Description |
---|---|---|
System. |
id |
Returns
Type | Description |
---|---|
IRead |
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. |
skip | The amount of items to skip |
System. |
take | The amount of items to take. |
Returns
Type | Description |
---|---|
Task<Paged |
A paged result of Relation |
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 ITracked
GetReferences(Int32)
Declaration
IReadOnlyDictionary<Udi, IEnumerable<string>> GetReferences(int id)
Parameters
Type | Name | Description |
---|---|---|
System. |
id |
Returns
Type | Description |
---|---|
IRead |
GetReferencesAsync(Guid)
Declaration
Task<Attempt<IReadOnlyDictionary<Udi, IEnumerable<string>>, DataTypeOperationStatus>> GetReferencesAsync(Guid id)
Parameters
Type | Name | Description |
---|---|---|
Guid | id | The guid Id of the IData |
Returns
Type | Description |
---|---|
Task<Attempt<IRead |
Move(IDataType, Int32)
Declaration
Attempt<OperationResult<MoveOperationStatusType>> Move(IDataType toMove, int parentId)
Parameters
Type | Name | Description |
---|---|---|
IData |
toMove | |
System. |
parentId |
Returns
Type | Description |
---|---|
Attempt<Operation |
MoveAsync(IDataType, Nullable<Guid>, Guid)
Moves a IData
Declaration
Task<Attempt<IDataType, DataTypeOperationStatus>> MoveAsync(IDataType toMove, Guid? containerKey, Guid userKey)
Parameters
Type | Name | Description |
---|---|---|
IData |
toMove | The data type that will be moved |
System. |
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<IData |
RenameContainer(Int32, String, Int32)
Declaration
Attempt<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
System. |
id | |
System. |
name | |
System. |
userId |
Returns
Type | Description |
---|---|
Attempt<Operation |
Save(IEnumerable<IDataType>, Int32)
Saves a collection of IData
Declaration
void Save(IEnumerable<IDataType> dataTypeDefinitions, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IData |
dataTypeDefinitions | IData |
System. |
userId | Id of the user issuing the save |
Save(IDataType, Int32)
Saves an IData
Declaration
void Save(IDataType dataType, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
IData |
dataType | IData |
System. |
userId | Id of the user issuing the save |
SaveContainer(EntityContainer, Int32)
Declaration
Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
Entity |
container | |
System. |
userId |
Returns
Type | Description |
---|---|
Attempt<Operation |
UpdateAsync(IDataType, Guid)
Updates an existing IData
Declaration
Task<Attempt<IDataType, DataTypeOperationStatus>> UpdateAsync(IDataType dataType, Guid userKey)
Parameters
Type | Name | Description |
---|---|---|
IData |
dataType | IData |
Guid | userKey | Key of the user issuing the update |
Returns
Type | Description |
---|---|
Task<Attempt<IData |
ValidateConfigurationData(IDataType)
Performs validation for the configuration data of a given data type.
Declaration
IEnumerable<ValidationResult> ValidateConfigurationData(IDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
IData |
dataType | The data type whose configuration to validate. |
Returns
Type | Description |
---|---|
IEnumerable<System. |
One or more System. |