Прочетете на английски Редактиране

Споделяне чрез


IRelatedEnd.Attach Method

Definition

Defines a relationship between two attached objects.

Overloads

Attach(IEntityWithRelationships)

Defines a relationship between two attached objects.

Attach(Object)

Defines a relationship between two attached objects.

Attach(IEntityWithRelationships)

Defines a relationship between two attached objects.

C#
public void Attach(System.Data.Objects.DataClasses.IEntityWithRelationships entity);

Parameters

entity
IEntityWithRelationships

The object being attached. entity must implement IEntityWithRelationships.

Remarks

The Attach method is used to define a relationship between two objects that are both attached to the same ObjectContext instance.

The RelatedEnd class explicitly implements the Attach method. The EntityCollection<TEntity> class uses this implementation to define relationships between the attached source object and the object attached to the collection. For more information, see Attaching and Detaching Objects.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.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

Attach(Object)

Defines a relationship between two attached objects.

C#
public void Attach(object entity);

Parameters

entity
Object

The object being attached.

Remarks

Use this method overload for entity classes that do not implement IEntityWithRelationships. Use the Attach method for entity classes that do implement IEntityWithRelationships.

The Attach method is used to define a relationship between two objects that are both attached to the same ObjectContext instance.

The RelatedEnd class explicitly implements the Attach method. The EntityCollection<TEntity> class uses this implementation to define relationships between the attached source object and the object attached to the collection. For more information, see Attaching and Detaching Objects.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 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