From 7a71afda0ebcb4a41636556aff8b3989f4bedb0e Mon Sep 17 00:00:00 2001 From: Tom Fulton Date: Mon, 28 Apr 2014 23:39:32 -0600 Subject: [PATCH] GetValue - *always* check the PropertyValueConverters Even if we want a string and the value is already a string, we should still hit the PropertyValueConverters for situations like the RTE's PVC, which performs parsing on the content. --- app/Umbraco/Umbraco.Archetype/Models/Property.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Umbraco/Umbraco.Archetype/Models/Property.cs b/app/Umbraco/Umbraco.Archetype/Models/Property.cs index a3c4522..902e434 100644 --- a/app/Umbraco/Umbraco.Archetype/Models/Property.cs +++ b/app/Umbraco/Umbraco.Archetype/Models/Property.cs @@ -28,9 +28,6 @@ namespace Archetype.Umbraco.Models public T GetValue() { - // If the value is of type T, just return it - if (Value is T) - return (T)Value; // Try Umbraco's PropertyValueConverters var converters = UmbracoContext.Current != null ? PropertyValueConvertersResolver.Current.Converters : Enumerable.Empty(); @@ -41,6 +38,10 @@ namespace Archetype.Umbraco.Models return convertedAttempt.Result; } + // If the value is of type T, just return it + if (Value is T) + return (T)Value; + // No PropertyValueConverters matched, so try a regular type conversion var convertAttempt2 = Value.TryConvertTo(); if (convertAttempt2.Success)