There is nothing problematic with it, no, but that isn't the way that we currently work.Instansiate (which also set the properties) run under the scope of the current resolving handler, as such, it cannot be resolved. It is only after we successfully create it that we can set it.
On Tue, Jan 27, 2009 at 9:42 PM, hammett <[email protected]> wrote: > > Then we have a bug. In theory the case I depicted is perfectly valid. > MEF supports it.. > > On Tue, Jan 27, 2009 at 6:40 PM, Ayende Rahien <[email protected]> wrote: > > Not that I can see. > > we would resolve one, but not both > > > > On Tue, Jan 27, 2009 at 6:27 PM, hammett <[email protected]> wrote: > >> > >> As long as they are both singletons and use properties, it should work > >> fine. > >> > >> On Tue, Jan 27, 2009 at 2:28 PM, Chucara <[email protected]> wrote: > >> > > >> > I've spent the last few hours looking for a concrete answer to this > >> > problem (I see others have had the same/similar), but I can't seem to > >> > find any documentation anywhere, nor an answer here that directly > >> > tells me what I need to do. > >> > > >> > My problem is that I have two services: > >> > > >> > Service1 : IService1 > >> > - Requires an instance of Service2 > >> > > >> > Service2: IService2 - requires an instance of Service1 > >> > > >> > In other words, a circular dependency. > >> > > >> > So far I've created a constructor for Service1: > >> > > >> > public Service1(IService2 service2) {...} > >> > > >> > I obviously can't do the same for Service2, so I tried to expose a > >> > property on Service2 (and IService2): > >> > > >> > public IService1 Service1 { get; set; } > >> > > >> > What is the missing link here? How do I let Windsor know that I needs > >> > to put the square peg (the Service1 instance) in the square hole (the > >> > Service1 property on Service2). > >> > > >> > ..if I leave it at that, Service2 never gets an instance of Service1. > >> > ..if I add the parameters like so: > >> > > >> > <component > >> > id="dummy" > >> > service="Mars.Client.IDummyService, Mars.Client" > >> > type="Mars.Client.DummyService, Mars.Client"> > >> > <parameters> > >> > <dummyService2>${dummy2}</dummyService2> > >> > </parameters> > >> > </component> > >> > > >> > <component > >> > id="dummy2" > >> > service="Mars.Client.IDummyService2, Mars.Client" > >> > type="Mars.Client.DummyService2, Mars.Client"> > >> > <parameters> > >> > <dummyService>${dummy}</dummyService> > >> > </parameters> > >> > </component> > >> > > >> > I get an Exception stating that Service1 can not initialized because > >> > it requires an instance of Service2 (and vice versa). > >> > > >> > > > >> > > >> > >> > >> > >> -- > >> Cheers, > >> hammett > >> http://hammett.castleproject.org/ > >> > >> > > > > > > > > > > > > > -- > Cheers, > hammett > http://hammett.castleproject.org/ > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
