views:

211

answers:

1

How do I get both source and target navigation property names for a given RelatedEnd?

+1  A: 

Assuming I need the target reference given a navigation property called 'prop'

// Get all related ends and find the reference for this FK
IEnumerable<IRelatedEnd> relEnds =
   ((IEntityWithRelationships)position).RelationshipManager.GetAllRelatedEnds();

EntityReference er = 
    relEnds.First(re => re.TargetRoleName == prop) as EntityReference;
James
Is there a way to get the property value itself?
Shimmy