I got it working the way I wanted too... all tests pass ;-)
It does involve a serious hack though : my own IReleasePolicy which
needs to be aware of the AbstractLifestyleManager.
And because only Track() is virtual in the provided ReleasePolicies, I
had to duplicate some code.
Here's a test demonstrating why I have this issue
[Fact]
public void StrangeSingleCallToRelease()
{
IWindsorContainer container =
new WindsorContainer()
.Register(Component.For<MyComponent>()
.LifeStyle.Custom<SingletonLifestyleManagerSpy>());
var componentOne = container.Resolve<MyComponent>();
var componentTwo = container.Resolve<MyComponent>();
Assert.Equal(componentOne, componentTwo);
Assert.Equal(2, SingletonLifestyleManagerSpy.Resolved);
container.Release(componentOne);
Assert.Equal(1, SingletonLifestyleManagerSpy.Released); // This
does nothing
container.Release(componentTwo);
Assert.Equal(1, SingletonLifestyleManagerSpy.Released); //
Release not called
}
I actually need this second call to LifestyleManager.Release ...
On Jul 7, 8:42 am, kilfour <
kilf...@gmail.com> wrote:
> It does not only limit the reference to a thread.
> For that I could have used the PerThread Lifestyle.
http://stw.castleproject.org/Windsor.LifeStyles.ashx#PerThread_3.