Changes for properties between EPiServer 6 and 7
The property system has changed quite a lot in EPiServer 7 and the need for writing custom properties has been greatly reduced. There have been many blog posts about the subject but here is a quick reference guide to help you move from the old property system to the new:
Task | EPiServer 6 |
EPiServer 7 | Additional reference |
---|---|---|---|
Validate values | Write a custom property |
Use the built in validation attributes or build your own |
http://www.david-tec.com/2012/06/EPiServer-7-Preview---Using-validation-attributes |
Custom storage of complex values |
Write a custom property |
Either use a block as a property or write a custom property | http://world.episerver.com/Blogs/Alexander-Haneng/Dates/2012/8/How-to-create-a-simple-Block-Type-in-EPiServer-CMS-7/ |
Change rendering | Write a custom property and write a custom property control that implements CreateDefaultControls | Write a custom property control or a user control inheriting from PropertyControlBase<T> and register it with the RendeDescriptor attribute. | http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2012/10/Custom-renderers-for-properties/ |
Change editing | Write a custom property and write a custom property control that implements CreateEditControls | Register an EditorDescriptor and add a Dojo/Dijit based editor. | http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2012/11/Creating-a-more-advanced-property-editor/ |
Additional hints
- Check the new Alloy template for examples of how to write custom properties, register templates and editors.
- If you want to let the editors have a selection or one or many choices this can be done on the server without having to create a custom editor. See: http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2012/9/EPiServer-7-Configuring-editors-for-your-properties/
- There is still support for your legacy properties by using a web forms based dialog. If your property has the same value type as one of the built in properties (int, string, category, url, xhtml string etc) you need to add an UIHint attribute to your model, otherwise the default editor for the type will be used.
Comments