예제 #1
0
        public void UpdateName(EntityTestId aggregateId, Name name)
        {
            if (name.ValidationStatus.IsValid && !AggregateId.Equals(aggregateId))
            {
                Apply(TestEntityAggregateUpdatedDomainEvent.From(AggregateId, name, Version));
            }

            AppendValidationResult(name.ValidationStatus.Failures);
        }
예제 #2
0
        public bool Equals(EventReader other)
        {
            if (other is null)
            {
                return(false);
            }

            return(AggregateId.Equals(other.AggregateId) &&
                   MajorVersion == other.MajorVersion &&
                   MinorVersion == other.MinorVersion);
        }
예제 #3
0
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            var other = (Event)obj;

            return(AggregateId.Equals(other.AggregateId) &&
                   ProcessId.Equals(other.ProcessId));
        }
예제 #4
0
        public override bool Equals(object obj)
        {
            var compareTo = obj as AggregateRoot;

            if (ReferenceEquals(this, compareTo))
            {
                return(true);
            }
            if (ReferenceEquals(null, compareTo))
            {
                return(false);
            }

            return(AggregateId.Equals(compareTo.AggregateId));
        }
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }

            var item = obj as CourseCreatedDomainEvent;

            if (item == null)
            {
                return(false);
            }

            return(AggregateId.Equals(item.AggregateId) && Name.Equals(item.Name) && Duration.Equals(item.Duration));
        }
        /// <summary>
        /// Creates a new domain event stream which has the appended domain event stream.
        /// </summary>
        /// <param name="streamToAppend">Domain event stream to append to this domain event stream.</param>
        /// <returns>New instance of domain event stream with the appended domain event stream.</returns>
        public DomainEventStream <TAggregateId> AppendDomainEventStream(IDomainEventStream <TAggregateId> streamToAppend)
        {
            if (streamToAppend == null)
            {
                throw new ArgumentNullException(nameof(streamToAppend));
            }

            if (!AggregateId.Equals(streamToAppend.AggregateId))
            {
                throw new InvalidOperationException("Cannot append domain event belonging to a different aggregate.");
            }

            if (EndVersion >= streamToAppend.BeginVersion)
            {
                throw new DomainEventVersionConflictException("Domain event streams contain some entries with overlapping versions.");
            }

            return(new DomainEventStream <TAggregateId>(AggregateId, this.Concat(streamToAppend)));
        }
예제 #7
0
 protected bool Equals(EventStreamChange other)
 {
     return(AggregateId.Equals(other.AggregateId));
 }