Пример #1
0
 private void Apply(RegistrationCreated @event)
 {
     Id                 = @event.AggregateRootId;
     Person             = @event.Person;
     RegistrationTarget = @event.RegistrationTarget;
     RegistrationDate   = @event.RegistrationDate;
 }
Пример #2
0
 public void ChangeRegistrationDate(RegistrationDate newRegistrationDate)
 {
     AddAndApplyEvent(new RegistrationDateChanged
     {
         AggregateRootId     = Id,
         NewRegistrationDate = newRegistrationDate
     });
 }
Пример #3
0
        public Registration(Guid id, Person person, RegistrationTarget registrationTarget, RegistrationDate registrationDate) : base(id)
        {
            if (id.Equals(Guid.Empty))
            {
                throw new ArgumentException(nameof(person), "Id cannot be an empty guid.");
            }
            if (person is null)
            {
                throw new ArgumentNullException(nameof(person), "Person cannot be null.");
            }
            if (registrationTarget is null)
            {
                throw new ArgumentNullException(nameof(registrationTarget), "RegistrationSubject cannot be null.");
            }
            if (registrationDate is null)
            {
                throw new ArgumentNullException(nameof(registrationDate), "RegistrationDate cannot be null.");
            }

            AddAndApplyEvent(new RegistrationCreated
            {
                AggregateRootId    = id,
                Person             = person,
                RegistrationTarget = registrationTarget,
                RegistrationDate   = registrationDate
            });
        }
Пример #4
0
 private void Apply(RegistrationDateChanged @event)
 {
     RegistrationDate = @event.NewRegistrationDate;
 }