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 alang...@winscribe.com www.winscribe.com Please consider the environment before printing this email! -----Original Message----- From: castle-project-users@googlegroups.com [mailto:castle-project-us...@googlegroups.com] On Behalf Of Krzysztof Kozmic Sent: Wednesday, 28 July 2010 12:39 p.m. To: castle-project-users@googlegroups.com 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 > alang...@winscribe.com > 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 castle-project-us...@googlegroups.com. To unsubscribe from this group, send email to castle-project-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to castle-project-us...@googlegroups.com. To unsubscribe from this group, send email to castle-project-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.