Wpf Prism中注册的类型在哪里?
在桌面快速启动解决方案的OrderModule中,它定义了一个变量,如下所示:Wpf Prism中注册的类型在哪里?,wpf,controller,prism,Wpf,Controller,Prism,在桌面快速启动解决方案的OrderModule中,它定义了一个变量,如下所示: this.container.Resolve<OrdersEditorPresentationModel>() 我认为这可能是一些默认签名,但在Prism文档中的另一个示例中,presenter构造函数具有不同的签名: public EmployeesPresenter(IEmployeesView view, IEmployeesListPresenter listPresenter
this.container.Resolve<OrdersEditorPresentationModel>()
我认为这可能是一些默认签名,但在Prism文档中的另一个示例中,presenter构造函数具有不同的签名:
public EmployeesPresenter(IEmployeesView view,
IEmployeesListPresenter listPresenter,
IEmployeesController employeeController)
这种类型不必在任何地方声明,因为它是一个具体的实现。对于不能自动实例化的接口,比如IMyInterface,您必须事先注册一个具体的实现,以便容器知道当对象具有IMyInterface类型的Depdency时实例化什么
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)