首页 新闻 会员 周边

autofac注入拦截无效问题

0
悬赏园豆:10 [已解决问题] 解决于 2020-06-08 11:22

有遇到过的吗?
我想不适用接口,要怎么处理。

builder.RegisterType<TestService>().InterceptedBy(typeof(TransactionInterceptor)).EnableClassInterceptors();//无效

builder.RegisterType<TestService>().As<ITestService>().InterceptedBy(typeof(TransactionInterceptor)).EnableInterfaceInterceptors();//有效

wmmbsky的主页 wmmbsky | 初学一级 | 园豆:192
提问于:2020-06-05 17:20
< >
分享
最佳答案
0
builder.Register(c => new CallLogger(Console.Out))
       .Named<IInterceptor>("log-calls");

https://autofaccn.readthedocs.io/en/latest/advanced/interceptors.html

收获园豆:10
悟行 | 专家六级 |园豆:12559 | 2020-06-06 10:37
其他回答(1)
0

public virtual

spritekuang | 园豆:202 (菜鸟二级) | 2022-01-18 19:24
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册