IDbSet<TEntity>.Add Method (TEntity)

 

Adds the given entity to the context underlying the set in the Added state such that it will be inserted into the database when SaveChanges is called.

Namespace:   System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

TEntity Add(
	TEntity entity
)

Parameters

entity
Type: TEntity

The entity to add.

Return Value

Type: TEntity

The entity.

Note that entities that are already in the context in some other state will have their state set to Added. Add is a no-op if the entity is already in the context in the Added state.