dotnetcore/AspectCore-Framework

Predicates.ForService 里面获取的类不全,导致无法aop

asuoghs opened this issue · 5 comments

   config.Interceptors.AddTyped<TimerInterceptorAttribute>((AspectPredicate)(method =>
                {
                    Type declaringType = method.DeclaringType;
                    string name = declaringType.Name;
                    if (declaringType.IsGenericType)
                        name = name.Split('`')[0];
                    Console.WriteLine("Class:" + name);
                    return name.Matches("*DCache") ||
                           (declaringType.FullName ?? declaringType.Name + "." + declaringType.Name).Matches(
                               "*DCache");
                }));
                输出的class发现不全,导致无法aop

麻烦补充下,没匹配到的class大概是什么样的,列举几个例子即可

没匹配的都是.net core 没有注册到容器里面的

那是正常的。。

能兼容这种方式吗

需要自己用AOP的原始API去创建代理