public void Update(string name, string description, string payload) { var evt = new CaseFileUpdatedEvent(Guid.NewGuid().ToString(), AggregateId, Version, DateTime.UtcNow, name, description, payload); Handle(evt); DomainEvents.Add(evt); }
private void Handle(CaseFileUpdatedEvent caseFileUpdatedEvent) { if (string.IsNullOrWhiteSpace(caseFileUpdatedEvent.Name)) { throw new AggregateValidationException(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("validation", "name must be specified") }); } if (string.IsNullOrWhiteSpace(caseFileUpdatedEvent.Description)) { throw new AggregateValidationException(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("validation", "description must be specified") }); } if (string.IsNullOrWhiteSpace(caseFileUpdatedEvent.Payload)) { throw new AggregateValidationException(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("validation", "payload must be specified") }); } try { CMMNParser.ParseWSDL(caseFileUpdatedEvent.Payload); } catch { throw new AggregateValidationException(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("validation", "xml file is not valid") }); } UpdateDateTime = caseFileUpdatedEvent.UpdateDatetime; Name = caseFileUpdatedEvent.Name; Description = caseFileUpdatedEvent.Description; Payload = caseFileUpdatedEvent.Payload; }
private void Handle(CaseFileUpdatedEvent caseFileUpdatedEvent) { if (string.IsNullOrWhiteSpace(caseFileUpdatedEvent.Name)) { throw new AggregateValidationException(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("validation", "name must be specified") }); } if (string.IsNullOrWhiteSpace(caseFileUpdatedEvent.Description)) { throw new AggregateValidationException(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("validation", "description must be specified") }); } Name = caseFileUpdatedEvent.Name; Description = caseFileUpdatedEvent.Description; UpdateDateTime = caseFileUpdatedEvent.UpdateDatetime; }