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).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---