Bagikan melalui


DatabaseSchemaUpdater.AddAssociation<T> Method

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

Adds a database association, such as a foreign key relationship, to a local database.

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

Syntax

'Declaration
Public Sub AddAssociation(Of T) ( _
    associationPropertyName As String _
)
public void AddAssociation<T>(
    string associationPropertyName
)

Type Parameters

  • T
    The entity type corresponding to the applicable database table.

Parameters

  • associationPropertyName
    Type: System.String
    The name of the association in the corresponding data context.

Remarks

The database does not change to reflect updates from the DatabaseSchemaUpdater object until the Execute() method is called. When that method is called, all changes are submitted to the local database as a single transaction, including version updates. Using a single transaction helps the database maintain integrity, such as in cases where the user exits the application during an upgrade.

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

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.