protected override void OnChangeCompleted( object relatedEntityObject, CustomStoreOperationKind changeKind ) { base.OnChangeCompleted(relatedEntityObject, changeKind); if (null != ObjectContextWeakRef) { Debug.Assert(relatedEntityObject is EntityObjectType); CustomObjectContext objectContext = ObjectContextWeakRef.Target; if (null != objectContext && null != RelationshipMetadata) { var thisRelationshipEnd = new CustomRelationshipEnd(_thisEndEntityObject, RelationshipMetadata.From); if (objectContext.RelationshipHelper.IsVisitedRelationshipEnd(thisRelationshipEnd)) { return; } try { objectContext.RelationshipHelper.AddToVisitedRelationshipEnds(thisRelationshipEnd); UpdateRelatedEndInternal(objectContext, (EntityObjectType)relatedEntityObject, changeKind); } finally { objectContext.RelationshipHelper.RemoveFromVisitedRelationshipEnds(thisRelationshipEnd); } } } }
protected void ValidateStateTransition( EntityObjectType relatedEntityObject, CustomStoreOperationKind changeKind ) { if (null != ObjectContextWeakRef) { CustomObjectContext objectContext = ObjectContextWeakRef.Target; if (null != objectContext && null != RelationshipMetadata) { var thisRelationshipEnd = new CustomRelationshipEnd(_thisEndEntityObject, RelationshipMetadata.From); if (objectContext.RelationshipHelper.IsVisitedRelationshipEnd(thisRelationshipEnd)) { return; } try { objectContext.RelationshipHelper.AddToVisitedRelationshipEnds(thisRelationshipEnd); ValidateStateTransitionInternal(objectContext, relatedEntityObject, changeKind); } finally { objectContext.RelationshipHelper.RemoveFromVisitedRelationshipEnds(thisRelationshipEnd); } } } }