Top Banner
Master of Datatypes
22

Master of Datatypes, Umbraco Be Festival

May 21, 2015

Download

Technology

Tim Geyssens

Slides from session at Umbraco BE festival, In this session we'll take a look at the datatype improvements introduced in v 4.6 and 4.7 of Umbraco.

By taking advantage of the data editor settings creating configurable datatypes is a breeze.

Combine that with the usercontrol wrapper and xml data storage and you'll be able to create complex and versatile custom datatypes in minutes.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Master of Datatypes, Umbraco Be Festival

Master of

Datatypes

Page 2: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes• Tim Geyssens

• Live in Belgium work for Umbraco• Core Work• Umbraco.tv episodes• Training• Support• Blog at Nibble.be

Page 3: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

Datatypes ?

Page 4: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

• Extendable (create your own)• More diffucult things to extend

Datatypes

Page 5: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

• Session goal• Rich & Configurable• Take advantage of the tools = easy

Datatypes

Page 6: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

• UsercontrolWrapper• Data Editor Settings• Xml Serialization• Razor

Tools

Page 7: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

• These tools make it really, really easy• (so might be a short session)• Altough I’ll be creating 3 datatypes

Warning

Page 8: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

UserControlWrapper

Page 9: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

• Any Usercontrol as datatype• Implement interface• IUsercontrolDataEditor• Single Member• Property Value (type object)

UC Wrapper

Page 10: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

Datatype #1

Page 11: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

Data Editor Settings

Page 12: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

• Add settings to your datatype• More flexibility, reuse options• Super Easy• Mark public properties with data editor

settings attribute

Data Editor Settings

Page 13: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

Datatype #2

Page 14: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

• Not limited to textbox• 21 types out of the box• Extend with your own types

Data Editor Settings

Page 15: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

XML Serialization

Page 16: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

• Store rich data (not a single value)• Xml properties (related links)• UC Wrapper return xml string• Custom to xml code or• Serialize your object

XML Serialization

Page 17: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

• Not familiar with serialization• 2 Helper Methods• SerializationHelper– ValueToXmlString(object value)– ValueFromXmlString(object value, Type type)

XML Serialization

Page 18: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

Datatype #3

Page 19: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

Razor

Page 20: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

• Outputting our XML Property• Easy with razor• .notation• Note that the root node is removed

Razor

Page 21: Master of Datatypes, Umbraco Be Festival

Master ofDatatypes

Questions ?

Page 22: Master of Datatypes, Umbraco Be Festival

Master of

Datatypes