Need help... Any ideas other than interception?

Jul 1 2008 3:24 PM
I have a problem very similar to the standard "logging" example in many interception tutorials... 

I would like to allow people to decorate certain "setter" properties such than when it is called, an event is fired.  I am pretty sure I could do this with interception, but I have been reading about various performance issues (similar performance issues as "Synchronized" attribute...  And this is code that will be accessed quite often)

Ex:
[MySpecialAttribute theProperty="SomeProperty"]
int SomeProperty
{
  get { return x;}
  set { x = value;}
}

And the result of calling SomeObject.SomeProperty = 5 is
x = 5;
fireevent("SomeProperty was set");

I like the attribute/interception approach because I already have to decorate these properties with an attribute (although currently not a performance hurting context attribute), so it seemed pretty nice to just add some capability to that attribute to fire the event as well.  But I don't want the performance hit related to "ContextBoundObject".  Any ideas?

Thanks in advance,
Jeff Plummer