建立自定義攔截器
攔截器需要 IInterceptor
介面。截獲的類中的任何公共方法都將被截獲 (包括 getter 和 setter)
public class MyInterceptor : IInterceptor
{
public void Intercept(IInvocation invocation)
{
//Calls the next method in the chain - The last one will be the
//original method that was intercepted
invocation.Proceed();
}
}