// converts the source value into the clr value // uses converters, else returns the source value // source: the property source value // preview: whether we are previewing or not public object ConvertSourceToObject(object source, bool preview) { // use the converter if any // else just return the source value return(_converter != null ? _converter.ConvertSourceToObject(this, source, preview) : source); }
public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview) { var value = _baseValueConverter.ConvertSourceToObject(propertyType, source, preview); var clrType = propertyType.ClrType; bool allowsMultiple = TypeHelper.IsIEnumerable(clrType); var modelType = allowsMultiple == true?TypeHelper.GetInnerType(clrType) : clrType; var castItems = CastSourceToList(value, modelType); return(allowsMultiple == true ? castItems : castItems.FirstOrNull()); }