Typed Factory is disposed before consuming component when container is disposed

10 views
Skip to first unread message

Konstantin

unread,
Sep 27, 2012, 5:32:08 AM9/27/12
to castle-pro...@googlegroups.com
I'm using typed factory to resolve transient components. Factory instance is injected via ctor dependency. When consuming component (singleton) tries to use factory in dispose method I get exception stating that factory is disposed and can not be used. I thought container should dispose consuming component first... Am I doing something wrong.

factory 
    interface IApplicationInstanceFactory
    {
        ApplicationInstance Create(string applicationId, string name, Version version, ApplicationParams applicationParams, AppServerContext context);
        void Release(ApplicationInstance instance);
    }

consuming component ctor
public Host(IApplicationInstanceFactory instanceFactory)

registration 
container.Register(
       Component.For<IApplicationInstanceFactory>().AsFactory(),
       Component.For<ApplicationInstance>().LifestyleTransient(),
       Component.For<IHost>().ImplementedBy<Host>().DependsOn(new { name = setup.Environment }),
)


Reply all
Reply to author
Forward
0 new messages