0
在棱鏡Commanding_Desktop快速啓動溶液,在OrderModule,它定義了一個變量爲以下:在棱鏡中註冊哪些類型?
this.container.Resolve<OrdersEditorPresentationModel>()
但其中這個被註冊,以便它可以被「解決」從容器中?我在下面看到OrdersRepository正在註冊,但我找不到在哪裏項目OrdersEditorPresentationModel正在註冊。
OrderModule.cs:
public void Initialize()
{
this.container.RegisterType<IOrdersRepository, OrdersRepository>(new ContainerControlledLifetimeManager());
OrdersEditorPresentationModel presentationModel = this.container.Resolve<OrdersEditorPresentationModel>();
...
}
OrdersEditorPresentationModel.cs:
public class OrdersEditorPresentationModel : INotifyPropertyChanged
{
...
public OrdersEditorPresentationModel(OrdersEditorView view, IOrdersRepository ordersRepository, OrdersCommandProxy commandProxy)
{
this.ordersRepository = ordersRepository;
this.commandProxy = commandProxy;
this.Orders = new ObservableCollection<OrderPresentationModel>();
this.PopulateOrders();
this.View = view;
view.Model = this;
}
...
在類型的構造上述被解決具有特定的簽名,但其中是這個簽名被定義爲:
public OrdersEditorPresentationModel(OrdersEditorView view,
IOrdersRepository ordersRepository,
OrdersCommandProxy commandProxy)
我想這可能是一些默認的簽名,但棱鏡文檔中的另一個例子,演示構造有不同的簽名:
public EmployeesPresenter(IEmployeesView view,
IEmployeesListPresenter listPresenter,
IEmployeesController employeeController)