have watched Mosh Hamedani's course on EF as well as read articles on MSDN. I have also read a few discussions over this. But I cannot still understand it properly.
I am trying to use Entity Framework with repository pattern in WPF. Now, everywhere I see people using repository pattern in such a way that it returns a IEnumerable of items. However, since I am trying to bind these to datagrids which needs to be updated, is it not better to return ObservableCollection?
Also, I watched a few tutorials where they blindly remove and replace ICollection and Hashset in the entities created by EF with ObservableCollection. However,there
is a tutorial in MSDN where it says, and I quote, "Find and replace the first occurrence of “HashSet” with “ObservableCollection”. This occurrence is located approximately at line 50. Do not replace the second occurrence of HashSet found later in the code." It does not even explain why I shouldn't replace the second occurrence at all.
Can anyone tell me how to understand which ICollection and Hashset are safe to be replaced with ObservableCollection?
As a side note, I have introduced INotifyPropertyChanged in Entities. Is it better practice to use ObservableObject?
Any help would be genuinely welcome.
What I have tried:
I have tried to blindly replace all ICollection and Hashsets to ObservableCollection, but surely, that doesn't work.