【问题标题】:Unity InjectionFactory and InterceptorsUnity InjectionFactory 和拦截器
【发布时间】:2014-07-01 07:03:38
【问题描述】:

我正在尝试将异常拦截器与注入工厂一起使用,如下所示:

container.RegisterType<IProcessorService>(
    new HierarchicalLifetimeManager(),
    new InjectionFactory(c => processorFactory.CreateChannel()),
    new Interceptor<InterfaceInterceptor>(), 
    new InterceptionBehavior<AppExceptionInterceptor>());

唯一的问题是拦截器不工作。注入工厂有效,但拦截器无效。对于其他类型,当我在不使用注入工厂的情况下执行拦截器时,一切都很好。

有什么想法吗?

为任何智慧干杯!!

【问题讨论】:

    标签: c# inversion-of-control unity-container aop ioc-container


    【解决方案1】:

    忘记给容器添加拦截扩展了!

    container.AddNewExtension<Interception>();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多