I want to be able to apply an attribute to an interface so that every method in any class that implements this interface has an attribute applied to it.
I assumed that it would look something like this:
[Serializable] [AttributeUsage(AttributeTargets.All, Inherited = true)] public sealed class TestAttribute : OnMethodBoundaryAspect { ... }
However, when I apply it to an interface, as shown below, the OnEntry / OnExit code in the attribute never opens when the method is called in a class that implements the interface:
[Test] public interface ISystemService { List<AssemblyInfo> GetAssemblyInfo(); }
If I applied the attribute inside the implementation class itself, as shown below, it works fine:
[Test] public class SystemService : ISystemService { ... }
What am I missing / doing wrong?
c # interface attributes postsharp
krisg
source share