Delen via


LocalView<TEntity>.Add(TEntity) Method

Definition

Adds a new entity to the DbContext. If the entity is not being tracked or is currently marked as deleted, then it becomes tracked as Added.

public virtual void Add (TEntity item);
abstract member Add : 'Entity -> unit
override this.Add : 'Entity -> unit
Public Overridable Sub Add (item As TEntity)

Parameters

item
TEntity

The item to start tracking.

Implements

Remarks

Note that only the given entity is tracked. Any related entities discoverable from the given entity are not automatically tracked.

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

Applies to