Circular dependecy in winforms app using Castle Windsor

Posted by Sven on Stack Overflow See other posts from Stack Overflow or by Sven
Published on 2009-08-17T14:49:17Z Indexed on 2010/04/26 10:43 UTC
Read the original article Hit count: 408

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about castle-windsor

Related posts about winforms