If you really *have to* you can create your own impl. instead of
TypedFactoryInterceptor, one that will copy the release policy of
parent container instead of using the default.
Then you'd have to remove the one added by facility which is
registered under the key: "Castle.TypedFactory.Interceptor" and
register your own for that key instead.

Can you describe your scenario in more details? Why don't you just
release the components you create via the factory?


On 13 Kwi, 09:54, Bailey Ling <[email protected]> wrote:
> After looking at source, the only thing I can think of is manually adding a
> commission step, and using reflection to change the private
> variable....yeah...definitely not pretty, but can be done in about 10 lines
> of code....seems to work fine.
>
> IMO the facility should adhere to the release policy of the kernel it's
> registered on, as I was not expecting the nasty surprise of production
> servers hitting 2 gigs of RAM :'(
>
> 2010/4/12 Krzysztof Koźmic <[email protected]>
>
> > You can't (at least not easily). Release you factory components.
>
> > On 2010-04-13 03:23, bling wrote:
>
> >> var k = new DefaultKernel();
> >> k.ReleasePolicy = new NoTrackingReleasePolicy();
> >> k.AddFacility<TypedFactoryFacility>();
> >> k.Register(Component.For<IFactory>().AsFactory());
> >> k.Register(Component.For<Something>().Lifestyle.Transient);
>
> >> var obj = k.Resolve<IFactory>().Create<Something>();
> >> var wr = new WeakReference(obj);
> >> obj = null;
> >> GC.Collect();
>
> >> Assert.IsFalse(wr.IsAlive);
>
> >> The above test will fail.  How can I prevent it from tracking
> >> instances?  Thanks.
>
> > --
> > 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]<castle-project-users%[email protected]>
> > .
> > 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 [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.

Reply via email to