I am trying to access a custom attribute applied to a method within a castle interceptor, e.g.:
[MyCustomAttribute(SomeParam = "attributeValue")]
public virtual MyEntity Entity { get; set; }
using the following code:
internal class MyInterceptor : IInterceptor
{
public void Intercept(IInvocation invocation)
{
if (invocation.Method.GetCustomAttributes(typeof(MyCustomAttribute), true) != null)
{
//Do something
}
}
}
The interceptor is firing OK when the method is called but this code does not return the custom attribute. How can I achieve this?