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.

C#
public virtual void Add (TEntity item);

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

Product Versions
Entity Framework Core 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0