Ah ok. Could you switch to v2.5b2 and see how it goes there?
Krzysztof On 28/07/2010 12:55 PM, Adam Langley wrote:
Im actually using the released 2.1.0.0 [assembly: AssemblyFileVersion("2.1.0.6655")] Adam Langley Senior Developer +64 9 486 9010 [email protected] www.winscribe.com Please consider the environment before printing this email! -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Krzysztof Kozmic Sent: Wednesday, 28 July 2010 2:20 p.m. To: [email protected] Subject: Re: component registration always results in SingletonLifestyleManager being applied From the top of my head that might have to do with the fact that you're registering pre-existing instance. I'm not sure if in that case the lifestyle does not get ignored altogether, as Windsor is not assuming ownership of pre-existing components. Just to make sure we're using the same code - are you running on v2.5b2? Krzysztof On 28/07/2010 12:08 PM, Adam Langley wrote:Thanks Krzysztof, I have changed the registration to this: Kernel.Register(Castle.MicroKernel.Registration.Component.For<IComponent>().Named("myname").Instance(component).LifeStyle.Custom<SingletonLifestyleManagerWithDispose>()); but curiously, I have stepped into the component registration, and the final ComponentModel that results from this configuration, has a CustomLifestyle of Null, and Lifestyle of Unknown. Can you point out why this might be? Adam Langley Senior Developer +64 9 486 9010 [email protected] www.winscribe.com Please consider the environment before printing this email! -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Krzysztof Kozmic Sent: Wednesday, 28 July 2010 12:39 p.m. To: [email protected] Subject: Re: component registration always results in SingletonLifestyleManager being applied Adam, you'd have to create a new lifestylemanager that works like SingletonLM but it's release does what TransientLM does. Should be very straightforward. Krzysztof On 28/07/2010 10:03 AM, Adam Langley wrote:Hi, I have noticed that the ContainerWrapper (an instance of System.ComponentModel.IContainer) class registers components with the Kernel using AddComponentInstance. This eventually results in a singleton lifestyle being applied - which is not particularly desirable, because it means that the added component will hang around in the lifestyle pool until the Kernel is disposed, even if the component is removed from the ContainerWrapper collection. How can I change this call to AddComponentInstance to a Register call, with arguments that will allow a component instance to be registered in a way that will allow the same instance to be returned from all Resolve calls (singleton behavior), but will be removed when Release is called (transient behavior)? Thanks Adam Langley Senior Developer +64 9 486 9010 [email protected] www.winscribe.com Please consider the environment before printing this email!
-- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
