I only want this invoked when a property is set. Why is this not working?
[DirtyTrackingAttribute(AttributeTargetElements =
PostSharp.Extensibility.MulticastTargets.Property)]
class Program
{
public static string Test { get; set; }
static void Main(string[] args)
{
TestIt();
Test = "foo";
Console.ReadKey();
}
private static void TestIt()
{
Console.WriteLine("Real method called");
}
}
[Serializable]
public class DirtyTrackingAttribute : OnMethodInvocationAspect
{
public override void OnInvocation(MethodInvocationEventArgs eventArgs)
{
Console.WriteLine("Property invoked");
eventArgs.Proceed();
}
}