我有一個視圖模型,它需要在構造函數中的兩個參數是相同類型:MVVM && IOC &&子的ViewModels
public class CustomerComparerViewModel
{
public CustomerComparerViewModel(CustomerViewModel customerViewModel1,
CustomerViewModel customerViewModel2)
{
}
}
public class CustomerViewModel
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
如果我不使用IOC我可以只新了視圖模型並傳入子視圖模型。我可以將兩個視圖模型打包到一個類中,並將其傳遞給構造函數,但是如果我有另一個只需要一個CustomerViewModel的視圖模型,我需要傳入視圖模型不需要的東西。
我該如何處理使用IOC的問題?我使用Ninject btw。
感謝