public < T > void delete ( T entity ) { if ( entity == null ) { throw new IllegalArgumentException ( "Entity cannot be null" ) ; } DocumentInfo value = documentsByEntity . get ( entity ) ; if ( value == null ) { throw new IllegalStateException ( entity + " is not associated with the session, cannot delete unknown entity instance" ) ; } deletedEntities . add ( entity ) ; includedDocumentsById . remove ( value . getId ( ) ) ; if ( _countersByDocId != null ) { _countersByDocId . remove ( value . getId ( ) ) ; } _knownMissingIds . add ( value . getId ( ) ) ; }
Marks the specified entity for deletion . The entity will be deleted when SaveChanges is called .