문제

I'm struggling to wire up a service interface using WcfIntegration with an IInterceptor.

There are examples for each in the autofac documentation but nothing that combines the two.

Here is the documentation for the WcfIntegration and look here for the DynamicProxy2 documentation.

Has anyone successfully wired up an interceptor with WcfIntegration using Autofac?

Example code I'd have expected to work:

            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");

EDIT:

Seems like a bug has been logged on autofac site. Any work arounds for this?

도움이 되었습니까?

해결책

As this has been raised as a bug on autofac bugtracker, If no one can see a workaround, I'll mark this as the answer. They have uploaded a console app reproducing the exact scenario.

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

EDIT: This has now been fixed in the latest version

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top