Duplicate Item Creation Problem (CAB)

Topics: CAB & Smart Client Software Factory
Jul 29, 2006 at 5:40 AM
originally posted by: m_a_madero

Ok, so simplifying the problem we have the following:

NewOrderController which configurates the services needed for this use case and start and Add the NewOrderPresenter to the WorkItem.Items collection:
presenter = this.Items.AddNew<NewOrderPresenter>();

NewOrderPresenter which instantites another presenter (OrderExpressPresenter) which have a dependency to the NewOrderPresenter:
public OrderExpressPresenter(Dependency NewOrderPresenter newOrderPresenter)

As we have the Dependency attribute, we tought it would just get it from the WorkItem.Items collection, but it is creating a new instance and this generates a runtime error when trying to add a second instance (which we dont need) to the Items collection.

Anybody, some idea?

I know this kind of dependencys is really common, for example if a presenter has a reference to the controller or something like that, so I dont see why it is now causing a problem.
Jul 29, 2006 at 12:21 PM
originally posted by: askew

Chris Holmes answered your CAB message board post for this quite well as usual: