I'm also looking to using the ContextualLifestyle, but I'm running into problems with the scope and factories. Basically, I'm not really able to wrap all my calls to my components with the scope, so any factories used as dependencies will no longer have access to the scope that was used when the factory was created. Any components created by the factory won't share the scope of the factory itself.
So it sounds like child containers are not the right approach here, I'll keep going down the ContextualLifestyle route... On Feb 1, 2:06 pm, Mauricio Scheffer <[email protected]> wrote: > Are you sure you want to use child containers? Didn't ContextualLifestyle > solve your > issue?http://stackoverflow.com/questions/4849397/sharing-instance-of-class-... > > -- > Mauricio > > > > > > > > On Tue, Feb 1, 2011 at 10:47 AM, Geoff Smith <[email protected]> wrote: > > Hi, > > > Does anyone have an example of using child containers to define the > > scope of a component? (Assuming this is possible) I.e. > > > class A > > { > > public A(B b) {} > > } > > > class B > > { > > public B(C c1, C c2) {} > > } > > > class C {} > > > For each instance of A, I want B to use the same instance of C for c1 > > and c2 (I know, a little contrived). But for each new instance of A > > should have a different instance of C. > > > 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%2Bun > > [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.
