diff --git a/src/Our.Umbraco.Ditto/ComponentModel/Processors/UmbracoPropertyAttribute.cs b/src/Our.Umbraco.Ditto/ComponentModel/Processors/UmbracoPropertyAttribute.cs
index 9f57f11..67aeaa4 100644
--- a/src/Our.Umbraco.Ditto/ComponentModel/Processors/UmbracoPropertyAttribute.cs
+++ b/src/Our.Umbraco.Ditto/ComponentModel/Processors/UmbracoPropertyAttribute.cs
@@ -118,7 +118,7 @@ public override object ProcessValue()
{
var contentProperty = contentType.GetProperty(umbracoPropertyName, BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Static);
- if (contentProperty != null)
+ if (contentProperty != null && contentProperty.IsMappable())
{
// This is more than 2x as fast as propertyValue = contentProperty.GetValue(content, null);
propertyValue = PropertyInfoInvocations.GetValue(contentProperty, content);
diff --git a/src/Our.Umbraco.Ditto/Extensions/Internal/PropertyInfoExtensions.cs b/src/Our.Umbraco.Ditto/Extensions/Internal/PropertyInfoExtensions.cs
index 68460be..96fbec8 100644
--- a/src/Our.Umbraco.Ditto/Extensions/Internal/PropertyInfoExtensions.cs
+++ b/src/Our.Umbraco.Ditto/Extensions/Internal/PropertyInfoExtensions.cs
@@ -36,5 +36,27 @@ public static bool IsVirtualAndOverridable(this PropertyInfo source)
var method = source.GetGetMethod();
return method.IsVirtual && !method.IsFinal;
}
+
+ ///
+ /// Checks to see if a model property is mappable by Ditto
+ ///
+ ///
+ /// The source .
+ ///
+ ///
+ /// True if the is mappable; otherwise, false.
+ ///
+ public static bool IsMappable(this PropertyInfo source)
+ {
+ // Make sure source is readable
+ if (!source.CanRead) return false;
+
+ // Check to make sure the get method has no parameters
+ var hasParams = source.GetIndexParameters().GetLength(0) > 0;
+ if (hasParams) return false;
+
+ // All checks have passed so allow it to be mapped
+ return true;
+ }
}
}
\ No newline at end of file