public CustomerAggregate(string firstName, string lastName, string nationalCode, Address homeAddress, Address workAddress, IEventBus eventBus) { EventBus = eventBus; this.firstName = firstName; this.lastName = lastName; HomeAddress = homeAddress; WorkAddress = workAddress; NationalCode = new NationalCode(nationalCode); EventBus.Publish(new CustomerCreatedEvent( Id, FirstName, LastName, HomeAddress.PostalCode, HomeAddress.City, HomeAddress.Province, WorkAddress.PostalCode, WorkAddress.City, WorkAddress.Province)); }
public virtual void ChangeNationalCode(NationalCode newNationalCode) { NationalCode = newNationalCode; EventBus.Publish(new CustomerNationalCodeChanged(Id, NationalCode.Code)); }