Compartir a través de


DataContext.GetChangeSet Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Provides access to the modified objects tracked by DataContext.

Namespace:  System.Data.Linq
Assembly:  System.Data.Linq (in System.Data.Linq.dll)

Syntax

'Declaration
Public Function GetChangeSet As ChangeSet
public ChangeSet GetChangeSet()

Return Value

Type: System.Data.Linq.ChangeSet
The set of objects is returned as three read-only collections.

Remarks

For information about using a local database in your Windows Phone application, see Local Database Overview for Windows Phone.

Note the following considerations:

  • GetChangeSet might have side effects, such as inference of insert and delete operations that are usually performed at the time of SubmitChanges. For example, objects that are used in the following operations can create corresponding inferred operations in the following list:

  • The set may not be ordered according to foreign key constraints.

  • Database-generated values (for example, primary and foreign key values, timestamps, and so forth) are not available. Such information requires database command execution and perhaps the propagation of retrieved information (for example, foreign key from primary key).

  • The set of changed objects is computed at the time of the call. Subsequent calls to SubmitChanges can produce a different set if additional changes are made.

Output when no changes have been made appears as follows:

{Added: 0, Removed: 0, Modified: 0}

Version Information

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.