Class DataTypeService
Represents the DataType Service, which is an easy access to operations involving IData
Namespace: Umbraco.Cms.Core.Services.Implement
Assembly: Umbraco.Core.dll
Syntax
public class DataTypeService : RepositoryService, IDataTypeService, IService
Constructors
View SourceDataTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IDataTypeRepository, IDataValueEditorFactory, IAuditRepository, IContentTypeRepository, IIOHelper, Lazy<IIdKeyMap>)
Declaration
public DataTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IDataTypeRepository dataTypeRepository, IDataValueEditorFactory dataValueEditorFactory, IAuditRepository auditRepository, IContentTypeRepository contentTypeRepository, IIOHelper ioHelper, Lazy<IIdKeyMap> idKeyMap)
Parameters
Type | Name | Description |
---|---|---|
ICore |
provider | |
ILogger |
loggerFactory | |
IEvent |
eventMessagesFactory | |
IData |
dataTypeRepository | |
IData |
dataValueEditorFactory | |
IAudit |
auditRepository | |
IContent |
contentTypeRepository | |
IIOHelper | ioHelper | |
Lazy<IId |
idKeyMap |
DataTypeService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IDataTypeRepository, IDataValueEditorFactory, IAuditRepository, IContentTypeRepository, IMediaTypeRepository, IMemberTypeRepository, IIOHelper, Lazy<IIdKeyMap>)
Declaration
public DataTypeService(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IDataTypeRepository dataTypeRepository, IDataValueEditorFactory dataValueEditorFactory, IAuditRepository auditRepository, IContentTypeRepository contentTypeRepository, IMediaTypeRepository mediaTypeRepository, IMemberTypeRepository memberTypeRepository, IIOHelper ioHelper, Lazy<IIdKeyMap> idKeyMap)
Parameters
Type | Name | Description |
---|---|---|
ICore |
provider | |
ILogger |
loggerFactory | |
IEvent |
eventMessagesFactory | |
IData |
dataTypeRepository | |
IData |
dataValueEditorFactory | |
IAudit |
auditRepository | |
IContent |
contentTypeRepository | |
IMedia |
mediaTypeRepository | |
IMember |
memberTypeRepository | |
IIOHelper | ioHelper | |
Lazy<IId |
idKeyMap |
Methods
View SourceCopy(IDataType, Int32)
Declaration
public 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
public 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
public async 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
public async 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
public 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
public void Delete(IDataType dataType, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
IData |
dataType | IData |
System. |
userId | Optional Id of the user issuing the deletion |
Remarks
Please note that deleting a IData
DeleteAsync(Guid, Guid)
Deletes an IData
Declaration
public async 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
public 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
public 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
public IEnumerable<IDataType> GetAll(params int[] ids)
Parameters
Type | Name | Description |
---|---|---|
System. |
ids | Optional array of Ids |
Returns
View SourceGetAllAsync(Guid[])
Gets multiple IData
Declaration
public 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
public 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
public Task<IDataType> GetAsync(string name)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | Name of the IData |
Returns
View SourceGetByEditorAlias(String)
Gets a IData
Declaration
public IEnumerable<IDataType> GetByEditorAlias(string propertyEditorAlias)
Parameters
Type | Name | Description |
---|---|---|
System. |
propertyEditorAlias | Alias of the property editor |
Returns
View SourceGetByEditorAliasAsync(String)
Gets all IData
Declaration
public 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
public async 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
public Task<IEnumerable<IDataType>> GetByEditorUiAlias(string editorUiAlias)
Parameters
Type | Name | Description |
---|---|---|
System. |
editorUiAlias | The UI Alias to query by. |
Returns
View SourceGetContainer(Guid)
Declaration
public EntityContainer GetContainer(Guid containerId)
Parameters
Type | Name | Description |
---|---|---|
Guid | containerId |
Returns
Type | Description |
---|---|
Entity |
GetContainer(Int32)
Declaration
public EntityContainer GetContainer(int containerId)
Parameters
Type | Name | Description |
---|---|---|
System. |
containerId |
Returns
Type | Description |
---|---|
Entity |
GetContainers(Int32[])
Declaration
public IEnumerable<EntityContainer> GetContainers(int[] containerIds)
Parameters
Type | Name | Description |
---|---|---|
System. |
containerIds |
Returns
Type | Description |
---|---|
IEnumerable<Entity |
GetContainers(String, Int32)
Declaration
public IEnumerable<EntityContainer> GetContainers(string name, int level)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | |
System. |
level |
Returns
Type | Description |
---|---|
IEnumerable<Entity |
GetContainers(IDataType)
Declaration
public IEnumerable<EntityContainer> GetContainers(IDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
IData |
dataType |
Returns
Type | Description |
---|---|
IEnumerable<Entity |
GetDataType(Int32)
Gets a IData
Declaration
public IDataType GetDataType(int id)
Parameters
Type | Name | Description |
---|---|---|
System. |
id | Id of the IData |
Returns
View SourceGetDataType(String)
Gets a IData
Declaration
public IDataType GetDataType(string name)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | Name of the IData |
Returns
View SourceGetListViewReferences(Int32)
Declaration
public 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
public 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
public IReadOnlyDictionary<Udi, IEnumerable<string>> GetReferences(int id)
Parameters
Type | Name | Description |
---|---|---|
System. |
id |
Returns
Type | Description |
---|---|
IRead |
GetReferencesAsync(Guid)
Declaration
public async 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
public 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)
Declaration
public async Task<Attempt<IDataType, DataTypeOperationStatus>> MoveAsync(IDataType toMove, Guid? containerKey, Guid userKey)
Parameters
Type | Name | Description |
---|---|---|
IData |
toMove | |
System. |
containerKey | |
Guid | userKey |
Returns
Type | Description |
---|---|
Task<Attempt<IData |
RenameContainer(Int32, String, Int32)
Declaration
public 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
public void Save(IEnumerable<IDataType> dataTypeDefinitions, int userId)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IData |
dataTypeDefinitions | IData |
System. |
userId | Id of the user issuing the save |
Save(IDataType, Int32)
Saves an IData
Declaration
public 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
public 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
public async 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
public 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. |