2012-05-09 9 views
3

WcfIntegration을 사용하는 서비스 인터페이스를 IInterceptor와 연결하는 데 어려움을 겪고 있습니다.DynamicProxy2를 사용하는 Autofac WcfIntegration을 이용한 차단

autofac 설명서에는 각각에 대한 예제가 있지만이 두 가지를 결합한 것은 없습니다.

여기에 WcfIntegration에 대한 설명서가 있으며 DynamicProxy2 설명서를 참조하십시오.

누구나 Autofac을 사용하여 WcfIntegration으로 인터셉터를 성공적으로 연결 했습니까?

예제 코드가 나는 일을 예상 한 것 :

  builder.Register(c => new CacheInterceptor()) 
      .Named<IInterceptor>("cache-calls"); 

     builder 
      .RegisterType<ChannelFactory<IEnquiryService>>() 
      .AsSelf() 
      .WithParameter(new NamedParameter("endpointConfigurationName", "EnquiryService")) 
      .SingleInstance(); 

     builder 
      .Register(c => c.Resolve<ChannelFactory<IEnquiryService>>().CreateChannel()) 
      .As<IEnquiryService>() 
      .EnableInterfaceInterceptors() 
      .InterceptedBy("cache-calls"); 

편집 :

버그가 autofac site.이에 대한 모든 작업 방법에 기록 된 것처럼 보인다?

답변

1

autofac bugtracker에서 버그로 제기되었으므로 아무도 해결 방법을 볼 수 없으면이 코드를 대답으로 표시합니다. 그들은 정확한 시나리오를 재현하는 콘솔 앱을 업로드했습니다.

http://code.google.com/p/autofac/issues/detail?id=361&q=dynamicproxy2

편집 :이 지금 최신 버전에서 수정되었습니다