Επεξεργασία

Κοινή χρήση μέσω


ITable.Attach Method

Definition

Allows deserialized entities to be associated with a new instance of a DataContext so that they can be updated or deleted from the database.

Overloads

Attach(Object)

Attaches an entity to the DataContext in an unmodified state.

Attach(Object, Boolean)

Attaches all entities of a collection to the DataContext in either a modified or unmodified state.

Attach(Object, Object)

Attaches an entity to the DataContext in either a modified or unmodified state by specifying both the entity and its original state.

Remarks

For more information about how to use this method, see Data Retrieval and CUD Operations in N-Tier Applications (LINQ to SQL).

If a required member is missing, a ChangeConflictException is thrown during SubmitChanges.

Attach(Object)

Attaches an entity to the DataContext in an unmodified state.

public:
 void Attach(System::Object ^ entity);
public void Attach (object entity);
abstract member Attach : obj -> unit
Public Sub Attach (entity As Object)

Parameters

entity
Object

The entity to be attached.

Remarks

For more information about how to use this method, see Data Retrieval and CUD Operations in N-Tier Applications (LINQ to SQL).

Applies to

Attach(Object, Boolean)

Attaches all entities of a collection to the DataContext in either a modified or unmodified state.

public:
 void Attach(System::Object ^ entity, bool asModified);
public void Attach (object entity, bool asModified);
abstract member Attach : obj * bool -> unit
Public Sub Attach (entity As Object, asModified As Boolean)

Parameters

entity
Object

The collection of entities.

asModified
Boolean

true to attach the entities as modified.

Remarks

For more information about how to use this method, see Data Retrieval and CUD Operations in N-Tier Applications (LINQ to SQL).

Applies to

Attach(Object, Object)

Attaches an entity to the DataContext in either a modified or unmodified state by specifying both the entity and its original state.

public:
 void Attach(System::Object ^ entity, System::Object ^ original);
public void Attach (object entity, object original);
abstract member Attach : obj * obj -> unit
Public Sub Attach (entity As Object, original As Object)

Parameters

entity
Object

The entity to be attached.

original
Object

An instance of the same entity type with data members that contain the original values.

Remarks

For more information about how to use this method, see Data Retrieval and CUD Operations in N-Tier Applications (LINQ to SQL).

Applies to