Is there an equivalent of the AspectJ call pointcut in PostSharp?
Concrete: Both ClassA and ClassB call method foo() on ClassC. I want to intercept calls only from A to C, NOT B to C. In AspectJ this can be achieved by pairing the call with the within pointcut like this:
call(* ClassC.foo()) && within(ClassA)
How would i achieve this in PostSharp?
This is not possible directly as MethodInterceptionAspect applies to a method itself not to a call site and as such the pointcut will be only able to filter methods, not call sites.
Possible solution would be to have two aspects that cooperate - one would manage a thread-static variable, the second one would either execute the intercepted method or do some additional work. However, this is not an ideal solution.