Created
July 23, 2012 20:05
-
-
Save adautoneto/3165905 to your computer and use it in GitHub Desktop.
Twit: ServiceStack IContainerAdapter for Castle Windsor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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