Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DbSetMigrationsExtensions::AddOrUpdate Method

Entity Framework 6.0
 

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

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticAddOrUpdate<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.

System_CAPS_pubmethodSystem_CAPS_staticAddOrUpdate<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.

Return to top

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.

Return to top

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.

Return to top
Show: