protected virtual object ReadProperty(string propertyName)
{
Node contentHandler = this.Content.ContentHandler;
var dynamicHandler = contentHandler as ISupportsDynamicFields;
if (dynamicHandler != null)
return dynamicHandler.GetProperty(propertyName);
var genericHandler = contentHandler as GenericContent;
if (genericHandler != null)
return genericHandler.GetProperty(propertyName);
var runtimeNode = contentHandler as Content.RuntimeContentHandler;
if (runtimeNode != null)
return runtimeNode.GetProperty(propertyName);
//-- with reflection:
Type type = contentHandler.GetType();
PropertyInfo prop = type.GetProperty(propertyName);
if (prop == null) // it can be null when property is ContentListProperty?
throw new InvalidOperationException(String.Concat("Property not found: ", propertyName, " (ContentType: ", this.Content.ContentType.Name, ")."));
MethodInfo getter = prop.GetGetMethod();
if (getter == null) // it can be null when property is ContentListProperty?
throw new InvalidOperationException(String.Concat("Property is not readable: ", propertyName, " (ContentType: ", this.Content.ContentType.Name, ")."));
return getter.Invoke(contentHandler, null);
}
protected virtual void WriteProperties(object value)