My aspect:
[Serializable]
[MulticastAttributeUsage(MulticastTargets.Class, Inheritance = MulticastInheritance.Strict)]
public sealed class NotifyPropertyChangedAttribute : InstanceLevelAspect
{
[OnLocationSetValueAdvice, MulticastPointcut(Targets = MulticastTargets.Property)]
public void OnPropertySet(LocationInterceptionArgs args)
{
if (args.Value == args.GetCurrentValue()) return;
args.ProceedSetValue();
IPersistent iENtity = this.Instance as IPersistent;
if (iENtity != null)
{
// do something with iENtity
// need to identify property name without using reflection
}
}
}
I have applied this NotifyPropertyChangedAttribute to entire class so I can process property changes, everything works as expected.
But I would like to know the name of the property which was changed (so I can store the names of dirty properties in some collection). I wanted to use LocationInterceptionArgs::Location but I read this:
"Using this property causes the aspect weaver to generate code that has non-trivial runtime overhead."
Is there any other way how I can get the name of affected property in my aspect but without using reflection or other code which has big runtime overhead?
Any ideas (or better - examples)? Maybe I can implement it some other way? I just need some way to identify the property at runtime, even without a name - just some value which I can use to find the property in some Dictionary<> later...
Thanks.