public void Register(DocumentBase document) { if (document != null) { _identityMap.Add(document); } }
public async Task <Exception> Dispatch(DocumentBase document) { var repository = GetRepository(document.GetType()); foreach (var documentMessage in document.Outbox.ToArray()) { try { var handler = GetHandler(documentMessage); await handler.Handle(documentMessage, _serviceFactory); document.ProcessDocumentMessage(documentMessage); await repository.Update(document); } catch (Exception ex) { return(ex); } } return(null); }
public abstract Task Update(DocumentBase document);