Skip to content

Instantly share code, notes, and snippets.

@adautoneto
Created July 23, 2012 20:05
Show Gist options
  • Save adautoneto/3165905 to your computer and use it in GitHub Desktop.
Save adautoneto/3165905 to your computer and use it in GitHub Desktop.
Twit: ServiceStack IContainerAdapter for Castle Windsor
internal sealed class WindsorContainerAdapter : IContainerAdapter
{
private readonly IWindsorContainer container;
public WindsorContainerAdapter(IWindsorContainer container)
{
this.container = container;
}
public T TryResolve<T>()
{
// http://groups.google.com/group/servicestack/browse_thread/thread/cf210359e243b9d5
return !this.container.Kernel.HasComponent(typeof(T)) ? default(T) : Resolve<T>();
}
public T Resolve<T>()
{
return this.container.Resolve<T>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment