DbContext.RemoveRange DbContext.RemoveRange DbContext.RemoveRange Method

Definition

Overloads

RemoveRange(Object[]) RemoveRange(Object[]) RemoveRange(Object[])

Begins tracking the given entity in the Deleted state such that it will be removed from the database when SaveChanges() is called.

RemoveRange(IEnumerable<Object>) RemoveRange(IEnumerable<Object>) RemoveRange(IEnumerable<Object>)

Begins tracking the given entity in the Deleted state such that it will be removed from the database when SaveChanges() is called.

RemoveRange(Object[]) RemoveRange(Object[]) RemoveRange(Object[])

Begins tracking the given entity in the Deleted state such that it will be removed from the database when SaveChanges() is called.

public virtual void RemoveRange (params object[] entities);
abstract member RemoveRange : obj[] -> unit
override this.RemoveRange : obj[] -> unit
Public Overridable Sub RemoveRange (ParamArray entities As Object())

Parameters

entities
Object[]

The entities to remove.

Remarks

If any of the entities are already tracked in the Added state then the context will stop tracking those entities (rather than marking them as Deleted) since those entities were previously added to the context and do not exist in the database.

Any other reachable entities that are not already being tracked will be tracked in the same way that they would be if AttachRange(Object[]) was called before calling this method. This allows any cascading actions to be applied when SaveChanges() is called.

RemoveRange(IEnumerable<Object>) RemoveRange(IEnumerable<Object>) RemoveRange(IEnumerable<Object>)

Begins tracking the given entity in the Deleted state such that it will be removed from the database when SaveChanges() is called.

public virtual void RemoveRange (System.Collections.Generic.IEnumerable<object> entities);
abstract member RemoveRange : seq<obj> -> unit
override this.RemoveRange : seq<obj> -> unit
Public Overridable Sub RemoveRange (entities As IEnumerable(Of Object))

Parameters

entities
IEnumerable<Object>

The entities to remove.

Remarks

If any of the entities are already tracked in the Added state then the context will stop tracking those entities (rather than marking them as Deleted) since those entities were previously added to the context and do not exist in the database.

Any other reachable entities that are not already being tracked will be tracked in the same way that they would be if AttachRange(IEnumerable<Object>) was called before calling this method. This allows any cascading actions to be applied when SaveChanges() is called.

Applies to