Table<TEntity>.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

ITable.Attach(Object, Boolean)

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

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

ITable.Attach(Object)

Attaches an entity to the DataContext in an unmodified state.

ITable.Attach(Object, Boolean)

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

C#
void ITable.Attach(object entity, bool asModified);

Parameters

entity
Object

The entity to be attached.

asModified
Boolean

true to attach the entity as modified; false to attached the entity as unmodified.

Implements

Remarks

This member is an explicit interface member implementation. It can be used only when the Table<TEntity> instance is cast to an ITable interface.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

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

C#
void ITable.Attach(object entity, object original);

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.

Implements

Remarks

This member is an explicit interface member implementation. It can be used only when the Table<TEntity> instance is cast to an ITable interface.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

ITable.Attach(Object)

Attaches an entity to the DataContext in an unmodified state.

C#
void ITable.Attach(object entity);

Parameters

entity
Object

The entity to be attached.

Implements

Remarks

This member is an explicit interface member implementation. It can be used only when the Table<TEntity> instance is cast to an ITable interface.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1