Instead of using child containers take a look at IHandlerSelector, it should be easier to implement.
Cheers, Mauricio On Mar 30, 7:28 pm, "Fabrice Durieu" <[email protected]> wrote: > Hello everyone, > > I'm new to castle and I'm trying to set something quite complicate and I'm > blocked on one point. > > So my question is quite simple: is it possible to have several containers > and decide which one will instantiate the WCF service ? > > I want to design an application for several customer, but each customer > can have specific setting like different kind of authorization, role > provider etc. Perfect situation for a container, so I want to use Castle: > a global container, and then subcontainer for each customer. > > When I look at the WCF integration facility, I don't find a way to handle > several containers and decide which one will instantiate the service ? > Because I need to create the service based on the user's company > (customer) > > I also tried to implement IServiceBehavior & IInstanceProvider to have my > own code instantiate the service (so I can use the container) > The problem is that I need to know, in the IInstanceProvider.GetInstance > method, for which customer the service must be created. > > What I tried: when the request start (Application_BeginRequest), I put the > company name on the Thread.CurrentPrincipal (own implementation of > IPrincipal). Then, in IInstanceProvider.GetInstance I retrieve company > from the CurrentPrincipal and use it to select the correct container. > > But ... the GetInstance is not called by the same thread, so the info is > not available. GetInstance is called by one of the IIS thread instead of > the thread handling the request (took from the thread pool). > > Anybody have an idea on how to solve my problem ? > > Thanks a lot for any help! -- 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.
