Predicates.ForService 里面获取的类不全,导致无法aop
asuoghs opened this issue · 5 comments
asuoghs commented
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 commented
麻烦补充下,没匹配到的class大概是什么样的,列举几个例子即可
asuoghs commented
没匹配的都是.net core 没有注册到容器里面的
liuhaoyang commented
那是正常的。。
asuoghs commented
能兼容这种方式吗
liuhaoyang commented
需要自己用AOP的原始API去创建代理