DbSetMigrationsExtensions::AddOrUpdate Method
Assembly: EntityFramework (in EntityFramework.dll)
| Name | Description | |
|---|---|---|
![]() ![]() | AddOrUpdate<TEntity>(IDbSet<TEntity>^, array<TEntity>^) | Adds or updates entities by key when SaveChanges is called. Equivalent to an "upsert" operation from database terminology. This method can useful when seeding data using Migrations. |
![]() ![]() | AddOrUpdate<TEntity>(IDbSet<TEntity>^, Expression<Func<TEntity, Object^>^>^, array<TEntity>^) | Adds or updates entities by a custom identification expression when SaveChanges is called. Equivalent to an "upsert" operation from database terminology. This method can useful when seeding data using Migrations. |
DbSetMigrationsExtensions::AddOrUpdate<TEntity> Method (IDbSet<TEntity>^, array<TEntity>^)
Adds or updates entities by key when SaveChanges is called. Equivalent to an "upsert" operation from database terminology. This method can useful when seeding data using Migrations.
public: generic<typename TEntity> where TEntity : ref class [ExtensionAttribute] static void AddOrUpdate( IDbSet<TEntity>^ set, ... array<TEntity>^ entities )
Parameters
- set
-
Type:
System.Data.Entity::IDbSet<TEntity>^
The set to which the entities belong.
- entities
-
Type:
array<TEntity>^
The entities to add or update.
Type Parameters
- TEntity
The type of entities to add or update.
When the set parameter is a custom or fake IDbSet implementation, this method will attempt to locate and invoke a public, instance method with the same signature as this extension method.
DbSetMigrationsExtensions::AddOrUpdate<TEntity> Method (IDbSet<TEntity>^, Expression<Func<TEntity, Object^>^>^, array<TEntity>^)
Adds or updates entities by a custom identification expression when SaveChanges is called. Equivalent to an "upsert" operation from database terminology. This method can useful when seeding data using Migrations.
public: generic<typename TEntity> where TEntity : ref class [ExtensionAttribute] [SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] static void AddOrUpdate( IDbSet<TEntity>^ set, Expression<Func<TEntity, Object^>^>^ identifierExpression, ... array<TEntity>^ entities )
Parameters
- set
-
Type:
System.Data.Entity::IDbSet<TEntity>^
The set to which the entities belong.
- identifierExpression
-
Type:
System.Linq.Expressions::Expression<Func<TEntity, Object^>^>^
An expression specifying the properties that should be used when determining whether an Add or Update operation should be performed.
- entities
-
Type:
array<TEntity>^
The entities to add or update.
Type Parameters
- TEntity
The type of entities to add or update.
When the set parameter is a custom or fake IDbSet implementation, this method will attempt to locate and invoke a public, instance method with the same signature as this extension method.

