EntitySet implementation of IList.Add


  • Why EntitySet`1 implementation of IList.Add does not raise ListChanged event:

    EntitySet<MyEntityClass> eset=...
    var lst=(IList)eset;

    And this code raises event:

    Saturday, December 8, 2007 7:25 PM

All replies

  • 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 Block




    Sunday, December 9, 2007 5:08 PM
  • No. 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 9, 2007 7:22 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>.

    Sunday, December 9, 2007 8:24 PM