讓我們假設我急切地加載一些商務的與NHibernate,EF或任何你想要的ORM工具...WPF/MVVM =>域集結成集ObservableCollections
現在我有一個IList,其中每個客戶有很多訂單和每個訂單都有很多產品。
您的CustomerRepository中有一個GetAllCustomer()方法。
,你在哪裏,你如何集中所有的數據到
類型的三個ObservableCollections客戶,訂單和產品,因爲我需要添加/刪除通知的事件!?
你真的做這樣的事情在BillingViewModel在您執行customerRepo.GetAllCustomer():
BillingViewModel.cs
private ObservableCollection<Customer> _customersOC = new ObservableCollection<Customer>();
public BillingViewModel()
{
var customers = customerRepo.GetAllCustomer();
ConvertDomainToUICollections(customers);
}
private ConvertDomainToUICollections(IList<Customer> customers)
{
foreach(Customer c in customers)
{
_customersOC.Add(c);
foreach(Order o in c.Orders)
{
// Here I do not know how to proceed and put each in another OC<Order> etc...
}
}
}
是的,我瞭解該工具及其功能。似乎是一個偉大的產品,如果提供。 – msfanboy 2011-01-29 21:49:06
很好,我現在再次檢查他們的主頁,他們在免費版中做了改動。以前,它只限於8張桌子。現在它僅限於用粗體字書寫的8個模型。之前我沒有選擇LS的原因是我有很多N:M的桌子超過了前8桌的規則,但是現在一切都完全符合8款車型,感謝里德在這裏間接回答你解決了我的問題:P – msfanboy 2011-01-29 22:08:46