private bool StoreValueAccessorValue(PropertyInfo property, MethodInfo getter, MethodInfo setter, IValueAccessor accessor, IInterceptableType interceptable) { var value = getter.Invoke(interceptable, null); var context = new ValueAccessorContext { Instance = interceptable, Property = property, BackingPropertyGetter = () => { throw new NotSupportedException("Getting property not supported while setting"); }, BackingPropertySetter = (v) => setter.Invoke(interceptable, new[] { v }) }; return(accessor.SetValue(context, property.Name, value)); }
private bool StoreValueAccessorValue(PropertyInfo property, MethodInfo getter, MethodInfo setter, IValueAccessor accessor, IInterceptableType interceptable) { var value = getter.Invoke(interceptable, null); var context = new ValueAccessorContext { Instance = interceptable, Property = property, BackingPropertyGetter = () => { throw new NotSupportedException("Getting property not supported while setting"); }, BackingPropertySetter = (v) => setter.Invoke(interceptable, new[] { v }) }; return accessor.SetValue(context, property.Name, value); }
public bool SetValue(ValueAccessorContext context, string propertyName, object value) { var item = context.Instance; var existing = item.GetChild(DefaultChildName ?? propertyName); if (existing == null && value != null) { item.SetChild(DefaultChildName ?? propertyName, value); if (!string.IsNullOrEmpty(DefaultChildZoneName)) ((ContentItem)value).ZoneName = DefaultChildZoneName; return true; } return false; }
public object GetValue(ValueAccessorContext context, string propertyName) { return context.Instance.GetChild(DefaultChildName ?? propertyName); }
public bool SetValue(ValueAccessorContext context, string propertyName, object value) { context.Instance.SetChildren(ZoneName ?? Name ?? propertyName, value as IEnumerable); return value != null; }
public object GetValue(ValueAccessorContext context, string propertyName) { return context.Instance.GetChildren(ZoneName ?? Name ?? propertyName) .ConvertTo(context.Property.PropertyType, propertyName); }