RelationshipManager.GetRelatedEnd Method (String, String)
Returns either an EntityCollection<TEntity> or EntityReference<TEntity> of the correct type for the specified target role in a relationship.
Assembly: EntityFramework (in EntityFramework.dll)
Parameters
- relationshipName
-
Type:
System.String
Name of the relationship in which targetRoleName is defined. The relationship name is not namespace qualified.
- targetRoleName
-
Type:
System.String
Target role to use to retrieve the other end of relationshipName .
Return Value
Type: System.Data.Entity.Core.Objects.DataClasses.IRelatedEndIRelatedEnd representing the EntityCollection<TEntity> or EntityReference<TEntity> that was retrieved.
Exception | Condition |
---|---|
ArgumentNullException | relationshipName or targetRoleName is null. |
InvalidOperationException | The source type does not match the type of the owner. |
ArgumentException | targetRoleName is invalid or unable to find the relationship type in the metadata. |