Szerkesztés

Megosztás a következőn keresztül:


IRelatedEnd.Add Method

Definition

Adds an object to the related end.

Overloads

Add(IEntityWithRelationships)

Adds an object to the related end.

Add(Object)

Adds an object to the related end.

Add(IEntityWithRelationships)

Adds an object to the related end.

public:
 void Add(System::Data::Objects::DataClasses::IEntityWithRelationships ^ entity);
public void Add (System.Data.Objects.DataClasses.IEntityWithRelationships entity);
abstract member Add : System.Data.Objects.DataClasses.IEntityWithRelationships -> unit
Public Sub Add (entity As IEntityWithRelationships)

Parameters

entity
IEntityWithRelationships

An object to add to the collection. entity must implement IEntityWithRelationships.

Remarks

The Add method adds an object to the related end. The related end must be an EntityCollection<TEntity>.

When the source object implements IEntityWithRelationships and is being tracked in the ObjectStateManager, the object being added is also tracked.

The RelatedEnd class explicitly implements the Add method. The EntityCollection<TEntity> class uses this implementation. For more information, see Add.

If the related end is an EntityReference<TEntity> and the Value property of the reference is not null, this method throws an exception.

Applies to

Add(Object)

Adds an object to the related end.

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

Parameters

entity
Object

An object to add to the collection.

Remarks

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

The Add method adds an object to the related end. The related end must be an EntityCollection<TEntity>.

The RelatedEnd class explicitly implements the Add method. The EntityCollection<TEntity> class uses this implementation. For more information, see Add.

If the related end is an EntityReference<TEntity> and the Value property of the reference is not null, this method throws an exception.

Applies to