コード例 #1
0
        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));
        }
コード例 #2
0
 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);
 }
コード例 #3
0
		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;
		}
コード例 #4
0
		public object GetValue(ValueAccessorContext context, string propertyName)
		{
			return context.Instance.GetChild(DefaultChildName ?? propertyName);
		}
コード例 #5
0
 public bool SetValue(ValueAccessorContext context, string propertyName, object value)
 {
     context.Instance.SetChildren(ZoneName ?? Name ?? propertyName, value as IEnumerable);
     return value != null;
 }
コード例 #6
0
 public object GetValue(ValueAccessorContext context, string propertyName)
 {
     return context.Instance.GetChildren(ZoneName ?? Name ?? propertyName)
         .ConvertTo(context.Property.PropertyType, propertyName);
 }