Export (0) Print
Expand All

DbSet.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)

public Object Add(
	Object entity
)

Parameters

entity
Type: System.Object

The entity to add.

Return Value

Type: System.Object
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