Autofac using DynamicProxy2 Interception with WcfIntegration - autofac

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

Related

Eclipse builder: How does it work?

Does anyone know any details on the underlying eclipse builder that sends jobs to the compiler and get its report? and how to tap to it? The level of abstraction that the builder extension offers is too high and the information insufficient. So I implemented an IResourceChangeListener and played with the ResourceDelta in order to get the messages from an IMarker. It works perfectly, however I realized the message is just returning a string. So my question is, how do I do in order to get the type/reference of the object where the error is, what type of error, what class it should belongs to and all available info.
Thanks.
Have you looked at the builder documentation?
And there is also This article by John.
I think between those two and looking at the code you will find everything you need to know.

RichTextToolbar in GWT 2.3

I'm trying to create a RichTextArea (following the GWT Showcase : link )
When I do a code completion of RichTextToolbar, I'm not able to find it. Is this an external library?
And then I googled and found this : google code link. Is this the same library in the Google Showcase? Or is the RichTextToolbar is an old implementation that not being brought to version 2.3?
Update:I tested this and what I feel is although the implementation the same, the UI looks different though.
It seems that they created their own version of RichTextToolbar.
This class is part of the GWT Showcase.
Here is a decent explanation to get the RichTextToolbar working. You take the source code from showcase basicaly.
http://www.jeanhsu.com/2010/06/10/how-to-use-richtexttoolbar-in-gwt/

Wicket 1.4 EJB Support

I tried implementing the JavaEE Inject jar from Wicket Stuff. (glassfish v3, wicket 1.4)
- however, the code given in the tutorial doesn't work
method
addComponentInstantiationListener in
class org.apache.wicket.Application
cannot be applied to given types
required:
org.apache.wicket.application.IComponentInstantiationListener
found:
org.wicketstuff.javaee.injection.JavaEEComponentInjector
looks to me like the API has changed. The JIRA link inside
http://wicketstuff.org/confluence/display/STUFFWIKI/JavaEE+Inject
and the Repository link are both broken. Is it still maintained?
Another short question: Is it possible to populate ListView directly with entity beans? I'd like to avoid too many proxy classes.
Thanks in advance
Yes, you can inject a ListView with entity beans. You should do so by creating an implementation of IDataProvider (or one of it's sub-interfaces) for the iterator and have it wrap the entities with LoadableDetachableModel so they can be reloaded instead of serialized as a part of the session.
Figured it out: I didn't expect there to be a difference between 1.4.13 and 1.4.14 but apparently the API changed there significantly.

RegisterType<> Not visible on Silverlight

I was following an example found here on StackOverflow, and everything went well until I need to register my types.
My web application is running on Silverlight 4, with Prism and MVVM.
The example is using "Microsoft.Practices.Unity" (it's a windows form application)
Bootstrapper.cs
protected override void ConfigureContainer()
{
base.ConfigureContainer();
Container.RegisterType<IApplicationMenuRegistry, MenuRegistry>();
Container.RegisterType<IApplicationCommands, ApplicationCommands>();
Container.RegisterType<ShellViewModel, ShellViewModel>(new Microsoft.Practices.Unity.ContainerControlledLifetimeManager());
}
Mine is using: Microsoft.Practices.Unity.Silverlight (web) and throws the following error:
The non-generic method 'Microsoft.Practices.Unity.IUnityContainer.RegisterType(...) cannot be used with type arguments.
And the RegisterType<> constructor is not visible for me. Which alternatives do I have to register my types?
I am using Unity for Silverlight and have not had this issue.
According to this post, http://unity.codeplex.com/workitem/8205, you need to add "using Microsoft.Practices.Unity;" to the file. The generic versions of Resolve are extension methods and you need to pull in the namespace to use them.
Apparently ReSharper may think the using statement is not needed and may remove it.
Hope that helps.

How To Get Automatic Registration With Castle Windsor

I recently read Ayende's blog post on automatic registration working with XML Configuration. I would like to do exactly what he does, but his code snippet doesn't work for me. The Register method doesn't exist on my container object.
Here's his code:
var container = new WindsorContainer(new XmlInterpreter());
container.Register(
AllTypes.Of(typeof (ConsumerOf<>))
.FromAssembly(typeof(Program).Assembly)
);
Is there a DLL reference I'm missing? Is Register() an extension method and I don't have the right namespace referenced? I've looked at the Castle Docs but can't seem to find a solution.
Bah! Nevermind. I'm using RC-3, and the Register() method is only in the trunk.