I’m building a WPF application and while creating my domain model I used ObservableCollection<T>.
I allowed myself to use it only because it clearly belongs to the System.Collections.ObjectModel namespace.
During execution I received an error. I found a thread in SO already deals with the problem in here: Where do I get a thread-safe CollectionView?
My question is: assuming ObservableCollection<T> is in System.Collections.ObjectModel namespace, why does it have a user interface related limitation? Is it an architecture flaw or intended? Is it good practice to use it in domain model?
I don’t view this as a design flaw at all. And we use them in our WPF domain models. We just make sure that anytime we update our observable collections, we do so on the UI thread. This is very easy to do. We’ve also created our own implementation so that anytime we update our observable collections, we disable the collection updated method until all items have been added or removed. This greatly increases binding performance.