Applies to Umbraco 6.x and newer
The DataTypeService acts as a "gateway" to Umbraco data for operations which are related to DataTypes and DataTypeDefinitions.
Browse the API documentation for DataTypeService.
- Namespace:
Umbraco.Core.Services - Assembly:
Umbraco.Core.dll
All samples in this document will require references to the following dll:
- Umbraco.Core.dll
All samples in this document will require the following usings:
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
Please note that this page will be updated with samples and additional information about the methods listed below
The DataTypeService is available through the ApplicationContext, but the if you are using a SurfaceController or the UmbracoUserControl then the DataTypeService is available through a local Services property.
Services.DataTypeService
Getting the service through the ApplicationContext:
ApplicationContext.Current.Services.DataTypeService
Gets a DataTypeDefinition by its Int Id.
Gets a DataTypeDefinition by its unique Guid Id.
Gets all DataTypeDefinition objects or those with the ids passed in.
Saves a DataTypeDefinition object.
Deletes a DataTypeDefinition object.
Gets an IDataType by its unique Id.
Gets a complete list of all registered DataTypes as IDataType objects.
Gets a DataTypeDefinition by its control Id.
Gets a String containing all prevalues for a DataTypeDefinition.
Gets an IEnumerable<String> containing all prevalues for a DataTypeDefinition.
Gets a PreValueCollection for a DataTypeDefinition.