title: EF Delete Child Object
body: <p>When removing a child entity from the parent entity collection I noticed that EF sets the childs entity state to be modified instead of deleted.</p>
  
  <p>Is there another property within the entity object manager which sets it to be deleted?</p>
  
  <p>Below is the code I am using within my Save method in the EF repository to find any child items that have been modified and then delete them.</p>
  
  <pre><code>Dim orphans = DataContextFactory.GetWMSDBContext().ChangeTracker.Entries().Where(Function(e) (e.State = EntityState.Modified) AndAlso TypeOf e.Entity Is StockTransferItem)
  For Each orphan In orphans
      orphan.State = EntityState.Deleted
  Next
  </code></pre>
  
  <p>The problem I am having is trying to detect the difference between updating and deleting because the state is set to modified for both. At the moment it is deleting the item when I update the record as well. Can I detect between the two states?</p>