Getting 'value' in around property setter advice

Jan 20, 2013 at 7:02 AM

Hello Hendry,

In an around property get advice, how do I get the value that is being set?


[SelectProperties("Setter & Name:'Foo'", SelectAccessorMethods=true)
public void UseTheValue(PropertyJoinPoint jp)
     object current_value = jp.Property.GetValue(jp.This);
     object new_value = ??;

Thanks, David K.

May 11, 2013 at 7:46 PM

I know this is a late response, but I came across your question whilst working out Around Property advice with Sheep myself. So maybe my response can help someone.

I believe the parameter 'value' to be used in the property 'Set' is in the Args array jp.Args[0] if you need access to it. To have it set just call jp.Execute.

Incidentally accessing the current property as you do above in 'Getter' around advice (I know you are not doing this, but in case it helps others as I didn't spot this at first) will result in a StackOverflowException as the 'Getter' advice will just be repeatedly, recursively called.