Doesn't this require a direct reference to the container and thus lose a great deal of benefit?
And it seems like the scope is global to the container...which would prevent multiple scopes on different threads, no? On Sep 27, 3:47 pm, Mauricio Scheffer <[email protected]> wrote: > Sounds like the scoped lifestyle in Windsor > 3:http://docs.castleproject.org/Windsor.Whats-New-In-Windsor-3.ashx#Add... > > Or the contextual lifestyle in Windsor > 2.x:http://blog.schuager.com/2010/11/contextual-lifestyle-reloaded.htmlhttps://github.com/castleprojectcontrib/Castle.Windsor.Lifestyles > > -- > Mauricio > > > > > > > > On Tue, Sep 27, 2011 at 4:35 PM, Jeff N <[email protected]> wrote: > > Basically as soon as I started using Windsor, I wrote custom > > LifestyleManagers for DisposableSingleton and DisposablePerThread > > lifestyles, because the default Singleton and PerThread Lifestyles do > > not allow releasing. > > > Why do I want this? Take the following scenario (note that I'm not > > actually using container.Resolve and Release in the real world). > > > var unitOfWork = container.Resolve<IUnitOfWork>(); > > > DoSomeWork(); > > > DoSomeMoreWork(); > > > container.Release(unitOfWork); > > > public static void DoSomeWork() > > { > > var repository = container.Resolve<IRepository1>(); // > > IRepository1 has a constructor that takes an IUnitOfWork...and we want > > it to get the IUnitOfWork in context. > > } > > > public static void DoSomeMoreWork() > > { > > var repository = container.Resolve<IRepository2>(); // > > IRepository2 has a constructor that takes an IUnitOfWork...and we want > > it to get the IUnitOfWork in context. > > } > > > So, am I doing something bad here or is there a reason Windsor > > shouldn't support this scenario by default? > > > -- > > 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. -- 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.
