城のインターセプター内のメソッドに適用されたカスタム属性にアクセスしようとしています。
[MyCustomAttribute(SomeParam = "attributeValue")]
public virtual MyEntity Entity { get; set; }
次のコードを使用します。
internal class MyInterceptor : IInterceptor
{
public void Intercept(IInvocation invocation)
{
if (invocation.Method.GetCustomAttributes(typeof(MyCustomAttribute), true) != null)
{
//Do something
}
}
}
メソッドが呼び出されると、インターセプターは正常に起動しますが、このコードはカスタム属性を返しません。どうすればこれを達成できますか?