public override IEnumerable <RelationEndPointID> GetOppositeRelationEndPointIDs() { var oppositeEndPointDefinition = Definition.GetOppositeEndPointDefinition(); Assertion.IsFalse(oppositeEndPointDefinition.IsAnonymous); return(from oppositeDomainObject in _loadState.GetData(this) select RelationEndPointID.Create(oppositeDomainObject.ID, oppositeEndPointDefinition)); }
public RelationEndPointID GetOppositeRelationEndPointID() { var oppositeEndPointDefinition = Definition.GetOppositeEndPointDefinition(); if (oppositeEndPointDefinition.IsAnonymous) { return(null); } var oppositeEndPointID = RelationEndPointID.Create(OppositeObjectID, oppositeEndPointDefinition); return(oppositeEndPointID); }
public static T GetEndPointWithOppositeDefinition <T> (this IRelationEndPoint endPoint, ObjectID oppositeObjectID) where T : IRelationEndPoint { ArgumentUtility.CheckNotNull("endPoint", endPoint); var oppositeDefinition = endPoint.Definition.GetOppositeEndPointDefinition(); var id = RelationEndPointID.Create(oppositeObjectID, oppositeDefinition); var oppositeEndPoint = endPoint.ClientTransaction.DataManager.GetRelationEndPointWithLazyLoad(id); if (!(oppositeEndPoint is T)) { var message = String.Format( "The opposite end point '{0}' is of type '{1}', not of type '{2}'.", oppositeEndPoint.ID, oppositeEndPoint.GetType(), typeof(T)); throw new InvalidOperationException(message); } return((T)oppositeEndPoint); }