1. yes, component != type. You register the type twice. 
2. you don't need two Components for repository. If it's lifetime is transient 
(or any safe subset of the two lifestyles of your DAL components) you'll just 
have two instances of a single component.
3. if not, then having a factory may be your best option.
-- 
Krzysztof Kozmic


On Tuesday, 9 July 2013 at 11:53 PM, Fabrice wrote:

> Sorry for late answer, I took a few days off.
> 
> So you say "2 components for dal" how could I do that ? I can't duplicate the 
> code.
> Or can I register the same class twice ?
> 
> But anyway the case above is the simplest one
> I've another case where W(CF Service) use a R(epository) which use the D(AL) 
> component. M(anager) also use Repository
> So we have:
> - W -> R  -> D
> - M -> R -> D
> So if I've 2 component for D, I'll need 2 component for R etc.
> 
> I think the only way is to use a factory and resolve a component each time M 
> have to use R or D 
> 
> 
> 
> 2013/7/3 Krzysztof Kozmic <krzysztof.koz...@gmail.com 
> (mailto:krzysztof.koz...@gmail.com)>
> > 1. Have two components for DAL (one as 'per WCF operation' the other 
> > transient or whatever makes sense) 
> > 2. Use Service Overrides to provide the right one where needed.
> > 3. Profit!
> > 
> > -- 
> > Krzysztof Kozmic
> > 
> > 
> > On Wednesday, 3 July 2013 at 12:53 AM, Fabrice wrote:
> > 
> > 
> > 
> > > Hi all,
> > > 
> > > I've a small problem and couldn't find a solution
> > > In my WCF app (using WcfFacility) I've 2 families of components:
> > > - The services => Transient (PerCall)
> > > - The manager ==> custom scope (PerCompany  
> > > (http://docs.castleproject.org/(S(sgex5w45y1suwnquu1b0gd55))/Windsor.Implementing%20custom%20scope.ashx)scope)
> > > (PerCompany means 1 component for each company, shared across all 
> > > webservice calls, and users belong to companies.)
> > > 
> > > They both need a dal component to be injected by the container.
> > > The dal component is registered using an hybrid lifestyle: 
> > > PerWCFOperation, and if not available then Transient.
> > > 
> > > The problem:
> > > STEP1: A user makes his 1st call to the webservice:
> > > 1) The service is instantiated, the dal component is created
> > > 2) A manager is instantiated. As the wcf operation context is available, 
> > > the same dal component is used (the one created above)
> > > 3) The service process the call, return the value
> > > 4) The service is destroyed, the dal component is destroyed
> > > 
> > > 
> > > STEP2: The same user makes his 2nd call to the webservice: 
> > > 1) Same: service created, dal component created
> > > 2) Manager already exist for this company, the same instance (used in the 
> > > 1st call) is retrieved
> > > ==> CRASH: The manager use a dal component disposed (STEP1.4)
> > > 
> > > So how could I configure the container to use a Transient dal component 
> > > for the managers ?
> > > 
> > > Thank you for your help!
> > > Fabrice
> > > 
> > > 
> > > 
> > > 
> > > -- 
> > > You received this message because you are subscribed to the Google Groups 
> > > "Castle Project Users" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an 
> > > email to castle-project-users+unsubscr...@googlegroups.com 
> > > (mailto:castle-project-users+unsubscr...@googlegroups.com).
> > > To post to this group, send email to 
> > > castle-project-users@googlegroups.com 
> > > (mailto:castle-project-users@googlegroups.com).
> > > Visit this group at http://groups.google.com/group/castle-project-users.
> > > For more options, visit https://groups.google.com/groups/opt_out.
> > >  
> > >  
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "Castle Project Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to castle-project-users+unsubscr...@googlegroups.com 
> > (mailto:castle-project-users%2bunsubscr...@googlegroups.com).
> > To post to this group, send email to castle-project-users@googlegroups.com 
> > (mailto:castle-project-users@googlegroups.com).
> > Visit this group at http://groups.google.com/group/castle-project-users.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >  
> >  
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to castle-project-users+unsubscr...@googlegroups.com 
> (mailto:castle-project-users+unsubscr...@googlegroups.com).
> To post to this group, send email to castle-project-users@googlegroups.com 
> (mailto:castle-project-users@googlegroups.com).
> Visit this group at http://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to