Skip to content

Source 枚举 介绍 ​

在我们做拦截器的时候,我们通常都是需要知道原生方法的一些情况的, AspectInjector 提供了 ArgumentAttribute配合参数枚举参数Source来实现。 下面就是Source的所有枚举项。

csharp

public enum Source : byte
{
   // 实例对象,如果是静态方法的话则为Null
   // 类型 object
    Instance = 1,

    //  类名 
    //  类型 Type
    Type = 2,
      
    //
    // 方法的元数据 
    // 类型System.Reflection.MethodBase
    Metadata = 3,

    //  被拦截的方法 委托
    //  类型 Func{object[],object}.
    //  只有是AspectInjector.Broker.Kind.Around的时候才能用
    Target = 4,
    //
    // 被拦截的方法名
    // 类型   string
    Name = 5,
    //
    // 参数
    // 类型 System.Object[].
    Arguments = 6,
    //
    // 原生方法的 返回值
    // 类型 System.Object
    // 只有是 AspectInjector.Broker.Kind.After的时候才能用
    ReturnValue = 7,
        
    //  返回值类型 类名 
    //  类型 Type
    ReturnType = 8,

    //
    // 被拦截方法上面的 attributes
    //  类型 System.Attribute[].
    Triggers = 9
}

简单就是美