LocalView<TEntity>.Remove(TEntity) Method

Definition

Marks the given entity as Deleted.

public virtual bool Remove (TEntity item);
abstract member Remove : 'Entity -> bool
override this.Remove : 'Entity -> bool
Public Overridable Function Remove (item As TEntity) As Boolean

Parameters

item
TEntity

The entity to delete.

Returns

true if the entity was being tracked and was not already Deleted.

Implements

Remarks

Entities that are currently marked as Added will be marked as Detached since the Added state indicates that the entity has not been saved to the database and hence it does not make sense to attempt to delete it from the database.

See Local views of tracked entities in EF Core for more information and examples.

Applies to