Circular dependecy in winforms app using Castle Windsor
- by Sven
Hello,
I was experimenting a little bit with Castle winforms in a winforms project. I wanted to register all my form dependencies with Castle windsor. This way I would have a single instance for all my forms.
Now I have some problem though.
I'm in a situation that form x has a dependency on form y and form y has a dependency on form x. Practical example maybe:
form x is used to create an order, form y is the screen that has a list of customers.
From form x there is a button to select a customer for the order. This will open form y where ou can search the customer. There is a button that lets you add the found customer to the order. It will call a method on form x and passes the selected customer object. I could do this with events. Raise an event in form y and listen for that in form x. But isn't there a way around the circular dependency in Castle Windsor, lazy registration or something?
Can anyone help me out?
Thanks in advance