I just write a post about my solution. I used the code from German to create a shared session.
You can read it here: http://blog.codiceplastico.com/index.php/2010/05/13/windsor-container-and-nhibernate-sessions/ Thanks to German! ema http://blog.codiceplastico.com On Wed, May 12, 2010 at 10:47 PM, bling <[email protected]> wrote: > You definitely need to publish it! > > I've been trying to find a solution to this for the past couple days > and the only thing I could come up with is creating child containers > and copying handlers from the parent down to the child and re- > registering them. That way, the child container == the context, and > its resolved components can get disposed when the child container gets > disposed. > > Unfortunately, the performance hit for creating child containers is > pretty bad, making this solution unusable if you're creating many > contexts. Creating 100,000 child containers takes a whopping 6.5 > seconds on my computer.... > > On May 8, 8:02 am, Germán Schuager <[email protected]> wrote: >> Hi, >> I've done something similar >> here:http://blog.schuager.com/2008/11/custom-windsor-lifestyle.html >> And although I think that that implementation is a little brittle you can >> take some ideas from there. >> >> Besides this, I've been experimenting with some way of explicitly defining >> resolution contexts... something like >> this:http://gist.github.com/320996(itworks for dependencies too) >> I need to publish this implementation somewhere, but in the meantime if you >> think it can help ping me and I will send it to you. >> >> On Sat, May 8, 2010 at 11:33 AM, Emanuele DelBono >> <[email protected]>wrote: >> >> >> >> > Hi all. >> >> > I 'm trying to register some components using Castle Windsor that has >> > a special treatment. The scenario is: >> >> > I have the class Model1 that has 2 dependencies Repo1 and Repo2 >> > Then I have a class Model2 that has 1 dependency Repo1 >> > Repo1 and Repo2 has 1 dependency on NH ISession (using a SessionFactory) >> >> > I would like that Repo1 and Repo2 have the same instance of ISession >> > if they are dependecies of Model1, but Repo1 should have another >> > instance if it is part of Model2. >> >> > What I need is that all the repositories of a particular model shares >> > the same ISession to be able to transact the operations on the >> > database (1 session per Model). >> >> > Thanks! >> >> > ema >> >http://blog.codiceplastico.com >> >> > -- >> > 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 >> athttp://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. > > -- 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.
