private static Action <IInvocation> GetInvokeValueAccessorSet(PropertyInfo property, IValueAccessor accessor) { return((invocation) => accessor.SetValue( new ValueAccessorContext { Instance = invocation.InvocationTarget as IInterceptableType, Property = property, BackingPropertyGetter = () => { throw new NotSupportedException("Getting property not supported while setting"); }, BackingPropertySetter = (value) => { invocation.Arguments[0] = value; invocation.Proceed(); } }, property.Name, invocation.Arguments[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)); }
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 static Action<IInvocation> GetInvokeValueAccessorSet(PropertyInfo property, IValueAccessor accessor) { return (invocation) => accessor.SetValue( new ValueAccessorContext { Instance = invocation.InvocationTarget as IInterceptableType, Property = property, BackingPropertyGetter = () => { throw new NotSupportedException("Getting property not supported while setting"); }, BackingPropertySetter = (value) => { invocation.Arguments[0] = value; invocation.Proceed(); } }, property.Name, invocation.Arguments[0]); }