Skip to content

Instantly share code, notes, and snippets.

@mookid8000
Created May 2, 2011 12:52
Show Gist options
  • Save mookid8000/951560 to your computer and use it in GitHub Desktop.
Save mookid8000/951560 to your computer and use it in GitHub Desktop.
NServiceBus still doesn't seem to release tracked components
public class EndpointConfiguration : IConfigureThisEndpoint,
AsA_Server,
IWantCustomInitialization,
IWantToRunAtStartup
{
readonly IWindsorContainer container;
public EndpointConfiguration()
{
container = new WindsorContainerDecorator()
.Register(Component.For<SomeDependency>());
}
public void Init()
{
Configure.With().CastleWindsorBuilder(container)
.XmlSerializer();
}
public void Run()
{
}
public void Stop()
{
container.Dispose();
}
class WindsorContainerDecorator : WindsorContainer
{
public override object Resolve(Type service)
{
Console.WriteLine("RESOLVING {0}", service);
return base.Resolve(service);
}
public override void Release(object instance)
{
Console.WriteLine("RELEASING {0}", instance);
base.Release(instance);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment