This documentation is archived and is not being maintained.

MergeOption Enumeration

Specifies how objects being loaded into the object context are merged with objects already in the object context.

Namespace:  System.Data.Objects
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

'Declaration
Public Enumeration MergeOption
'Usage
Dim instance As MergeOption

Member nameDescription
AppendOnlyObjects that already exist in the object context are not loaded from the data source. This is the default behavior for queries or when calling the Load method on an EntityCollection(Of TEntity).
OverwriteChangesObjects are always loaded from the data source. Any property changes made to objects in the object context are overwritten by the data source values.
PreserveChangesObjects are always loaded from the data source. However, any property changes made to objects in the object context are preserved.
NoTrackingObjects are maintained in a Detached state and are not tracked in the ObjectStateManager.

PreserveChanges is used to force changes to objects in the object context to save successfully after an OptimisticConcurrencyException has occurred. For more information, see Saving Changes and Managing Concurrency (Entity Framework).

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5 SP1
Show: