I've had an improved implementation of this lifestyle but it was not published anywhere until today. Yesterday I asked Mauricio if he could review it and add it to Castle.Windsor.Lifestyles project on github and he certainly did that. I think that the implementation is cleaner and it also allows you to explicitly define the context under which the contextual components should live; if you don't specify a context then it is assumed that the context is delimited by the current call to container.Resolve
The project is here: https://github.com/castleprojectcontrib/Castle.Windsor.Lifestyles and you can review its usage in the tests: https://github.com/castleprojectcontrib/Castle.Windsor.Lifestyles/blob/master/Castle.Windsor.Lifestyles.Tests/Contextual/ContainerContextFixture.cs On Thu, Nov 18, 2010 at 10:43 PM, José F. Romaniello <[email protected] > wrote: > Every session management infrastructure should implement > icurrentsessioncontext , that way our daos depends upon nhibernate. > OTOH i use the same dao and query objects for web apps, desktop and so > on. > > 2010/11/18, Germán Schuager <[email protected]>: > > I haven't been involved in a project based on a fat client for quite some > > time now, but I think that if I need to start something from scratch > right > > now I wouldn't use NH facility; instead I'd use NH own mecanism based on > > implementing ICurrentSessionContext and accessing ISessions via > > ISessionFactory.GetCurrentSession(). > > I'd probably take a look at what's in uNhAddins. > > > > 2010/11/17 Krzysztof Koźmic <[email protected]> > > > >> Germán what's your current approach out of curiosity? > >> > >> Krzysztof > >> > >> > >> On 18/11/2010 12:43 PM, Germán Schuager wrote: > >> > >> Although I don't use this approach anymore for managing NH sessions, > maybe > >> you can take some ideas from these posts: > >> http://blog.schuager.com/2008/11/custom-windsor-lifestyle.html > >> http://blog.schuager.com/2009/03/rich-client-nhibernate-session.html > >> > >> On Wed, Nov 17, 2010 at 8:13 PM, SimonB > >> <[email protected]>wrote: > >> > >>> Castle Windsor creates multiple instances of grand child objects using > >>> transient lifestyle. > >>> > >>> I have an object graph: > >>> - Object A has a dependency on C1 and C2. > >>> - C1 and C2 both have a dependency on GC. > >>> - I need C1 and C2 to have the same GS in a given build up. > >>> > >>> Using StructureMap a single instance of GC is created and passed to > >>> both C1 and C2. > >>> Using Castle.Windsor a new instance of GC is created for C1 and C2 - > >>> ie 2 instances. > >>> > >>> In my case GS is managing a nHibernate session, and C1 and C2 are > >>> repositories used by domain class A. > >>> > >>> Castle Windsor is returning 2 sessions causing cross session data > >>> errors. > >>> > >>> Does anyone know how to get access to or use the build up context so > >>> the instances of child objects can be cached like structure map. > >>> > >>> Thanks, > >>> > >>> SB > >>> > >>> -- > >>> 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]> > <castle-project-users%[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]<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]<castle-project-users%[email protected]> > <castle-project-users%[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]<castle-project-users%[email protected]> > . > > For more options, visit this group at > > http://groups.google.com/group/castle-project-users?hl=en. > > > > > > -- > Enviado desde mi dispositivo móvil > > -- > 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.
