tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/173-confused-about-singleton-in-parent-injectorRobotlegs: Discussion 2013-04-28T10:28:23Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/17539072010-05-22T17:54:53Z2010-05-22T17:54:53ZConfused about singleton in parent injector<div><p>Can you post an example where this isn't working? Hard to say
what is going wrong without some source. All of my examples/tests
with child injectors have honored the singleton mappings.</p></div>Joel Hookstag:robotlegs.tenderapp.com,2009-10-18:Comment/17539072010-05-22T18:08:13Z2010-05-22T18:08:13ZConfused about singleton in parent injector<div><p>Wow Joel, that was a fast response!! So it sounds like my
assumption was correct. I'm not certain the best way to post code
since this is such a big project. However, you did confirm my
interpretation so I need to ensure that I didn't mess up the
parent/child relationship AND that I didn't define a "SessionModel"
at the child level the overrides the parent mapping. If I can't
figure it out, I will try to post examples. BTW, I am using RL
1.1.0 and SS 1.5.1. Thanks Joel!<br></p></div>Jim Boonetag:robotlegs.tenderapp.com,2009-10-18:Comment/17539072010-05-22T18:41:12Z2010-05-22T18:41:12ZConfused about singleton in parent injector<div><p>Are you loading SWFs dynamically? Beware the ApplicationDomain
in that scenario.</p>
<p>To show some code just create a super simplified example as a
sanity check.</p></div>Joel Hookstag:robotlegs.tenderapp.com,2009-10-18:Comment/17539072010-05-22T22:25:25Z2010-05-22T22:25:25ZConfused about singleton in parent injector<div><p>Joel,</p>
<p>I am loading modules dynamically and indeed the modules were
being loaded in a different application domain, hence no class
visibility and my problem. Through the beauty of SS and DI, I was
able to define my ApplicationDomain and inject it into the module
contexts just in time before the child injectors are created. All
is good now Joel! Thank you for your help. This is almost PFM!!
Thanks for helping me navigate the bleeding edge ;-)</p>
<p>Jim</p></div>Jim Boonetag:robotlegs.tenderapp.com,2009-10-18:Comment/17539072010-05-22T23:12:23Z2010-05-22T23:12:23ZConfused about singleton in parent injector<div><p>You notice that Injector#createChild() takes an
ApplicationDomain as an optional param. This was added to address
this issue. They recommend using a child domain as best
practice.</p></div>Joel Hooks