Share via


EntityList<TEntity>.Attach method

Registers a disconnected or "detached" entity with the object tracking system of the DataContext object associated with the list.

Namespace:  Microsoft.SharePoint.Linq
Assembly:  Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)

Syntax

'Declaration
Public Sub Attach ( _
    entity As TEntity _
)
'Usage
Dim instance As EntityList
Dim entity As TEntity

instance.Attach(entity)
public void Attach(
    TEntity entity
)

Parameters

  • entity
    Type: TEntity

    The entity that is registered.

Exceptions

Exception Condition
ArgumentNullException

entity is a null reference (Nothing in Visual Basic).

InvalidOperationException

Object tracking is not enabled for the DataContext object.

- or -

entity is not of the same type as the list items.

- or -

entity has been deleted.

- or -

There is a problem with the internal ID of entity that is used by the object tracking system.

See also

Reference

EntityList<TEntity> class

EntityList<TEntity> members

Microsoft.SharePoint.Linq namespace