Skip to content

Commit

Permalink
Swapped type conversion order so that ConvertSourceToObject is tried …
Browse files Browse the repository at this point in the history
…first
  • Loading branch information
mattbrailsford committed Mar 2, 2016
1 parent a7f4410 commit 1784520
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ private static T DoInnerGetVortoValue<T>(this IPublishedContent content, string
// IPropertyValueConverter which are the ones most people are creating
var properyType = CreateDummyPropertyType(targetDataType.Id, targetDataType.PropertyEditorAlias, content.ContentType);

// Try convert data to source
var converted = properyType.ConvertDataToSource(value, false);
// Try convert source to object
var converted = properyType.ConvertSourceToObject(value, false);
if (converted is T)
return (T)converted;

var convertAttempt = converted.TryConvertTo<T>();
if (convertAttempt.Success)
return convertAttempt.Result;

// Try convert source to object
converted = properyType.ConvertSourceToObject(value, false);
// Try convert data to source
converted = properyType.ConvertDataToSource(value, false);
if (converted is T)
return (T)converted;

Expand Down

0 comments on commit 1784520

Please sign in to comment.