EntityReference<TEntity> Class
Represents a related end of an association with a multiplicity of zero or one.
System.Data.Objects.DataClasses::RelatedEnd
System.Data.Objects.DataClasses::EntityReference
System.Data.Objects.DataClasses::EntityReference<TEntity>
Assembly: System.Data.Entity (in System.Data.Entity.dll)
The EntityReference<TEntity> type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | EntityKey | Returns the key for the related object. (Inherited from EntityReference.) |
![]() | IsLoaded | Gets a value that indicates whether all related objects have been loaded. (Inherited from RelatedEnd.) |
![]() | RelationshipName | Gets the name of the relationship in which this related end participates. (Inherited from RelatedEnd.) |
![]() | RelationshipSet | Returns a reference to the metadata for the related end. (Inherited from RelatedEnd.) |
![]() | SourceRoleName | Gets the role name at the source end of the relationship. (Inherited from RelatedEnd.) |
![]() | TargetRoleName | Gets the role name at the target end of the relationship. (Inherited from RelatedEnd.) |
![]() | Value | Gets or sets the related object returned by this EntityReference<TEntity>. |
| Name | Description | |
|---|---|---|
![]() | Attach | Creates a many-to-one or one-to-one relationship between two objects in the object context. |
![]() | CreateSourceQuery | Creates an equivalent object query that returns the related object. |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetEnumerator | Returns an IEnumerator that iterates through the collection of related objects. (Inherited from RelatedEnd.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | Load() | When overridden in a derived class, loads the related object or objects into the related end with the default merge option. (Inherited from RelatedEnd.) |
![]() | Load(MergeOption) | Loads the related object for this EntityReference<TEntity> with the specified merge option. (Overrides RelatedEnd::Load(MergeOption).) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | OnDeserialized | Infrastructure. Used internally to deserialize entity objects along with the RelationshipManager instances. (Inherited from RelatedEnd.) |
![]() | OnRefDeserialized | Infrastructure. This method is used internally to serialize related entity objects. |
![]() | OnSerializing | Infrastructure. This method is used internally to serialize related entity objects. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() | AssociationChanged | Occurs when a change is made to a related end. (Inherited from RelatedEnd.) |
| Name | Description | |
|---|---|---|
![]() ![]() | IRelatedEnd::Add(IEntityWithRelationships) | Adds an object to the related end. (Inherited from RelatedEnd.) |
![]() ![]() | IRelatedEnd::Add(Object) | Adds an object to the related end. (Inherited from RelatedEnd.) |
![]() ![]() | IRelatedEnd::Attach(IEntityWithRelationships) | Attaches an object at the related end. (Inherited from RelatedEnd.) |
![]() ![]() | IRelatedEnd::Attach(Object) | Attaches an object to the related end. (Inherited from RelatedEnd.) |
![]() ![]() | IRelatedEnd::CreateSourceQuery | Returns an IEnumerable that represents the objects that belong to the related end. (Inherited from RelatedEnd.) |
![]() ![]() | IRelatedEnd::Remove(IEntityWithRelationships) | Removes an object from the collection at the related end. (Inherited from RelatedEnd.) |
![]() ![]() | IRelatedEnd::Remove(Object) | Removes an object from the related end if the object is part of the related end. (Inherited from RelatedEnd.) |
An EntityReference<TEntity> object is returned by a navigation property when the related end has a multiplicity of zero or one. For more information, see Navigation Properties (EDM).
An EntityReference<TEntity> object might have a corresponding EntityCollection<TEntity> (one-to-many relationship) or EntityReference<TEntity> (one-to-one relationship) at the other end of the relationship. When an EntityReference<TEntity> and an EntityCollection<TEntity> model opposing ends of the same relationship, the integrity of the relationship is maintained at the object level.
This class cannot be inherited.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
