locked
how to get deleted items from domaincontext RRS feed

  • Question

  • Hello,

    I want to get the deleted items from the domaincontext like this

    var removed = domaincontext1.Customers.Where(c => c.EntityState == EntityState.Deleted); // doesn't work

    but the result is always empty, although the RemovedEntities count in the ChangeSet is correct.

    Can anyone explain me the handling of  the deleted items because with added items it's no problem to get it with similar code like

    var added = domaincontext1.Customers.Where(c => c.EntityState == EntityState.New); // works

    Is there a chance to receive the deleted items from the domaincontext or do I have to track the deleted items on my own.

    Thanks for your help

    Bye

    Uwe

    Tuesday, July 27, 2010 6:05 PM

Answers

  • Hello again,

    in between I've solved the problem. I haven't seen that the EntityChangeSet has a GetChangeSetEntries method.

    This method gives me all the information I need.

    When deleting an item it seems that the item is not just marked as deleted but detached from the entity list, so that my where condition ...Where(c => c.EntityState == EntityState.Deleted) does not deliver anything.

    Bye

    Uwe

     

    Wednesday, July 28, 2010 11:04 AM