Export (0) Print
Expand All

IDbSet<TEntity>.Add Method

Entity Framework 5.0

Adds the given entity to the context the Added state. When the changes are being saved, the entities in the Added states are inserted into the database. After the changes are saved, the object state changes to Unchanged.

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
Returns the entity.

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.

Show:
© 2014 Microsoft