1.去NuGet下载 Castle.Core.dll

2.建一个普通的类。注意:本类2个方法,测试是否走拦截器。这里只有标记Virtual才能实现方法拦截。代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Castle
{
   public class TestInterceptor
    { 
        public virtual void MethodInterceptor()
        { 
            Console.WriteLine("走过滤器");
        }

        public void NoInterceptor()
        {
            Console.WriteLine("没有走过滤器");
        } 
    }
}
View Code

相关文章:

  • 2021-12-02
  • 2021-09-14
  • 2021-11-20
  • 2022-02-22
  • 2022-12-23
  • 2022-12-23
  • 2022-02-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-18
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
相关资源
相似解决方案