public void CompleteLink(Guid processId, LibraryId acceptingLibraryId) { if (LinkedLibraries.Contains(acceptingLibraryId)) { return; } if (!SentLinkRequests.Contains(acceptingLibraryId)) { return; } RaiseEvent(new LinkCompleted(processId, Id, acceptingLibraryId.Id)); }
public void ReceiveLinkRequest(Guid processId, LibraryId sourceLibraryId) { if (ReceivedLinkRequests.Contains(sourceLibraryId)) { return; } if (SentLinkRequests.Contains(sourceLibraryId)) { return; } if (LinkedLibraries.Contains(sourceLibraryId)) { return; } RaiseEvent(new LinkRequestReceived(processId, Id, sourceLibraryId.Id)); }
public void RequestLink(Guid processId, LibraryId desinationLibraryId) { if (SentLinkRequests.Contains(desinationLibraryId)) { return; } if (ReceivedLinkRequests.Contains(desinationLibraryId)) { return; } if (LinkedLibraries.Contains(desinationLibraryId)) { return; } RaiseEvent(new LinkRequested(processId, Id, desinationLibraryId.Id)); }
protected virtual void When(LinkCompleted @event) { SentLinkRequests.Remove(new LibraryId(@event.AcceptingLibraryId)); LinkedLibraries.Add(new LibraryId(@event.AcceptingLibraryId)); }
protected virtual void When(LinkRequested @event) { SentLinkRequests.Add(new LibraryId(@event.TargetLibraryId)); }