-
Notifications
You must be signed in to change notification settings - Fork 6
Umbraco Data Type C# Data Type Grid
Below is a list of supported built-in Umbraco property editors with the supported .Net types that we support and recommend mapping them to. Some specific .Net types are not fully supported due to limitations in type editor functionality or backing storage fields in Umbraco. These are called out where known, but may not be completely comprehensive.
When in doubt or running into issues, anything will map to System.String
so you can use that to assist in debugging.
Property Editor | Recommended .Net Types | Notes |
---|---|---|
Checkbox List | System.String[] |
Umbraco publishes actual values of checked items, not their prevalue IDs |
Color Picker | System.String |
Would like to add support for System.Drawing.Color
|
Content Picker |
System.Object System.Int32
|
Where Object is an UmbracoEntity decorated ORM object. int value will store document ID |
Date/Time | System.DateTime |
Content must be parseable in Standard System.DateTime.Parse(string) format. |
Date | System.DateTime |
Content must be parseable in Standard System.DateTime.Parse(string) format. |
Dictionary Picker | System.String[] |
Has not yet been tested with an i18n site. Additional work needs to be done to better support multi-language sites. |
Dropdown list multiple, publish keys | System.Int32[] |
Umbraco publishes the prevalue IDs which needs lookup to retrieve values. umbraco.library.GetPreValueAsString(id)
|
Dropdown list multiple | System.String[] |
|
Dropdown List, publishing keys | System.Int32 |
Umbraco publishes the prevalue ID which needs lookup to retrieve value. umbraco.library.GetPreValueAsString(id)
|
Dropdown list |
System.String System.Enum
|
Enum properties can be parsed if decorated with [UmbracoEnumProperty] attribute. |
Image Cropper | Not yet supported | |
Integer | System.Int32 |
Only allows for ints. Other types don't support the full ranges with this editor or allow floating point values. |
Macro Container | Not yet supported | |
Media Picker |
System.Object System.Int32
|
Where Object is an UmbracoMediaEntity decorated ORM object. int value will store the media ID |
Member Picker | Not yet supported | |
Multi-Node Tree Picker |
IEnumerable<Object> System.Int32[]
|
Where Object is an UmbracoEntity decorated ORM object. Currently only supported with CSV output (not XML output). int values will be the document IDs |
Multiple Textstring | System.String |
|
No edit | Depends on data type | Can vary widly depending on the data type used in this field, as it's typically reserved for specific non-editable data. |
Radiobutton list | System.Int32 |
Umbraco publishes the prevalue ID which needs lookup to retrieve value. umbraco.library.GetPreValueAsString(id)
|
Related Links | Not yet supported | |
Slider |
System.Int32 System.String
|
use int for single values and string for range. Would like to eventually parse range into a Tuple of sorts. |
Tags | System.String[] |
|
Textbox Multiple | System.String |
|
Textbox | System.String |
|
True/false (Ja/Nej) | System.Boolean |
Other fields can map but must contain the value true or 1
|
TinyMCE v3 wysiwyg |
System.Web.HtmlString System.String
|
Decorate property with the RichTextTypeHandler such that Umbraco Macros within it can be processed. |
Ultimate Picker (AutoComplete) |
System.Object System.Int32
|
Where Object is an UmbracoEntity decorated ORM object. int value will store the Document ID. |
Ultimate Picker (CheckBoxList) |
IEnumerable<Object> System.Int32[]
|
Where Object is an UmbracoEntity decorated ORM object. int[] value will store the Document IDs. |
Ultimate Picker (DropDownList) |
System.Object System.Int32
|
Where Object is an UmbracoEntity decorated ORM object. int value will store the Document ID. |
Ultimate Picker (ListBox) |
IEnumerable<Object> System.Int32[]
|
System.Object System.Int32
|
Ultimate Picker (RadioButtonList) |
System.Object System.Int32
|
Where Object is an UmbracoEntity decorated ORM object. int[] value will store the Document IDs. |
UltraSimpleEditor |
System.Web.HtmlString System.String
|
|
Umbraco Usercontrol Wrapper | Depends on data type | You will need to select a type that is appropriate for the output of your editor |
Upload field | System.String |
Will contain a url to the path of the uploaded media item. e.g., /media/1001/headshot.jpg
|
XPath CheckBoxList |
IEnumerable<Object> System.Int32[]
|
Where Object is an UmbracoEntity decorated ORM object. Currently only supported with CSV output (not XML output) |
XPath DropDownList |
Object System.Int32
|
Where Object is an UmbracoEntity decorated ORM object. int value will be the document ID |
since 1.2.0
In addition to the above core data types, a nullable data type has been added since v1.2.0. Any of the above data types that are basic types or structs can be instantiated via Nullables. (e.g., DateTime?
or int?
)
since 1.2.0
Vault can map JSON data by using the attribute [UmbracoJsonProperty(typeof(MySerializableJsonObject))]
as an attribute on your properties. Newtonsoft.Json is used to perform deserialization. Here's an example:
[UmbracoEntity(AutoMap = true)]
public class Location
{
public string Name { get; set; }
// This will map the JSON object
// { "Latitude": 44.986656, "Longitude": -93.258133 }
// to this LatLngCoordinates object for the document property "LatLng"
[UmbracoJsonProperty(typeof(LatLngCoordinates))]
public LatLngCoordinates LatLng { get; set; }
}
public class LatLngCoordinates
{
public double Latitude { get; set; }
public double Longitude { get; set; }
}
Note that these are documented for Umbraco property editors. Meaning, they do not necessarily have the same names as the default data type objects that exist in the Umbraco database and come as defaults in a vanilla Umbraco instance. For example, an Umbraco Data Type object of "Dropdown" has a property editor of "Dropdown list" but multiple "Dropdown list" data type objects can be created. We support all instances of data type objects using these given type editors.
It is possible to create your own TypeHandlers to fill in any gaps or add additional support. Please see Extending Vault for additional information on how to do this. Please also feel free to send a pull request or report an issue for any requests for adding additional support.
Lastly, the list is not necessarily comprehensive. Data Type editors may be paresable to other .Net types, but these are the types that are recommended, supported and tested by the team. Type editors have been created for all basic System
namespace built-in data types. (e.g., long
, ulong
, float
, etc.) Any issues with the translation from type editor value to object should be reported as an issue. For example, System.Char
can be a type mapped, but none of the built in editors support functionality to limit content editors to only enter 1 character.