DbSet.Add(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public virtual object Add (object entity);
abstract member Add : obj -> obj
override this.Add : obj -> obj
Public Overridable Function Add (entity As Object) As Object
Parameters
- entity
- Object
The entity to add.
Returns
The entity.
Remarks
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.
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Entity Framework