Duplicate Item Creation Problem (CAB)

Topics: CAB & Smart Client Software Factory
Jul 29, 2006 at 4: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 11:21 AM
originally posted by: askew

Chris Holmes answered your CAB message board post for this quite well as usual:
http://www.gotdotnet.com/codegallery/messageboard/thread.aspx?id=22f72167-af95-44ce-a6ca-f2eafbf2653c&mbid=c09776ca-f94c-4c83-a80c-75d381cabdd6&threadid=4840b639-d60c-46f4-80fb-5e5da38b03d2