I'm working on a Compact Framework application that uses the IoC library and follows the Model-View-Presenter pattern. I do this by adding the view (SmartPart) to the SmartParts collection, then manually instantiating the presenter by passing an instance
of the view. Any service dependencies are passed in via service dependency properties.
AdminView view = RootWorkItem.SmartParts.GetOrCreate<AdminView>("view:Admin");
AdminPresenter presenter = RootWorkItem.Items.Get<AdminPresenter>("presenter:Admin");
if (presenter == null)
presenter = new AdminPresenter(view);
I would prefer to have the IoC container pass in service dependencies via an injection constructor, but I'm not sure how to pass in the view. It doesn't feel right to create the view in the SmartParts collection and then add it to the Services collection. Is
there a better way?