Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
asuoghs opened this issue Oct 18, 2023 · 5 comments
Open

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

asuoghs opened this issue Oct 18, 2023 · 5 comments

Comments

@asuoghs
Copy link

asuoghs commented Oct 18, 2023

   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
@liuhaoyang
Copy link
Member

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

@asuoghs
Copy link
Author

asuoghs commented Oct 18, 2023

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

@liuhaoyang
Copy link
Member

那是正常的。。

@asuoghs
Copy link
Author

asuoghs commented Oct 18, 2023

能兼容这种方式吗

@liuhaoyang
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants