EntitySet implementation of IList.Add
-
Saturday, December 08, 2007 7:25 PMWhy EntitySet`1 implementation of IList.Add does not raise ListChanged event:
EntitySet<MyEntityClass> eset=...
var lst=(IList)eset;
lst.Add(myEntity);
And this code raises event:
lst.Remove(myEntity);
All Replies
-
Sunday, December 09, 2007 5:08 PM
Your problem might be caused by the fact that the EntitySet only raises the ListChanged event if it is fully loaded. To force an empty EntitySet to load, use the following code:
Code Blockeset.Assign(null);
-
Sunday, December 09, 2007 7:22 PMNo. EntitySet is loaded.
If you decompile the EntitySet via the Reflector, you will see, that there is no ListChanged event raising in the IList.Add implementation.
Is it bug? -
Sunday, December 09, 2007 8:24 PM
Sorry, my bad, you're right.
Seems like one more bug in the EntitySet implementation. The rest of the IList implementation seems to be mapped correctly to IList<T>.

