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?