Share via


RelatedEnd Class

Definition

Base class for EntityCollection and EntityReference

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
[System.Runtime.Serialization.DataContract]
[System.Serializable]
public abstract class RelatedEnd : System.Data.Entity.Core.Objects.DataClasses.IRelatedEnd
type RelatedEnd = class
    interface IRelatedEnd
Public MustInherit Class RelatedEnd
Implements IRelatedEnd
Inheritance
RelatedEnd
Derived
Attributes
Implements

Properties

IsLoaded

Gets or sets a value indicating whether the entity (for an EntityReference or all entities in the collection (for an EntityCollection<TEntity> have been loaded from the database.

RelationshipName

Gets the name of the relationship in which this related end participates.

RelationshipSet

Gets a reference to the metadata for the related end.

SourceRoleName

Gets the role name at the source end of the relationship.

TargetRoleName

Gets the role name at the target end of the relationship.

Methods

GetEnumerator()

Returns an IEnumerator that iterates through the collection of related objects.

Load()

Loads the related object or objects into the related end with the default merge option.

Load(MergeOption)

Loads an object or objects from the related end with the specified merge option.

LoadAsync(CancellationToken)

Asynchronously loads the related object or objects into the related end with the default merge option.

LoadAsync(MergeOption, CancellationToken)

Asynchronously loads an object or objects from the related end with the specified merge option.

OnDeserialized(StreamingContext)

Used internally to deserialize entity objects along with the RelationshipManager instances.

Events

AssociationChanged

Occurs when a change is made to a related end.

Explicit Interface Implementations

IRelatedEnd.Add(IEntityWithRelationships)

Adds an entity to the related end. This method works in exactly the same way as Add(object). It is maintained for backward compatibility with previous versions of IRelatedEnd.

IRelatedEnd.Add(Object)

Adds an entity to the related end. If the owner is attached to a cache then the all the connected ends are added to the object cache and their corresponding relationships are also added to the ObjectStateManager. The RelatedEnd of the relationship is also fixed.

IRelatedEnd.Attach(IEntityWithRelationships)

Attaches an entity to the related end. This method works in exactly the same way as Attach(object). It is maintained for backward compatibility with previous versions of IRelatedEnd.

IRelatedEnd.Attach(Object)

Attaches an entity to the related end. If the related end is already filled or partially filled, this merges the existing entities with the given entity. The given entity is not assumed to be the complete set of related entities. Owner and all entities passed in must be in Unchanged or Modified state. Deleted elements are allowed only when the state manager is already tracking the relationship instance.

IRelatedEnd.CreateSourceQuery()

Returns an IEnumerable that represents the objects that belong to the related end.

IRelatedEnd.Remove(IEntityWithRelationships)

Removes an entity from the related end. This method works in exactly the same way as Remove(object). It is maintained for backward compatibility with previous versions of IRelatedEnd.

IRelatedEnd.Remove(Object)

Removes an entity from the related end. If owner is attached to a cache, marks relationship for deletion and if the relationship is composition also marks the entity for deletion.

Applies to