I have an existing project where I would like to find out all calls being made and maybe dump into a log file.
I had a look at this thread, but didnt help much. I tr
PostSharp certainly offers a way to apply an aspect to several targets without decorating them with attributes explicitly. See Multicast attributes.
When developing (multicast) aspect you must specify its usage:
[MulticastAttributeUsage(MulticastTargets.Method, TargetMemberAttributes = MulticastAttributes.Instance)]
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true)]
[Serializable]
public class TraceAttribute : MethodInterceptionAspect
{
// Details skipped.
}
And then apply the aspect in a way that covers your use case (eg. all public members in AdventureWorks.BusinessLayer namespace):
[assembly: Trace( AttributeTargetTypes="AdventureWorks.BusinessLayer.*", AttributeTargetMemberAttributes = MulticastAttributes.Public )]