//Domain-Eventhandlers private void Apply(CustomerCreatedEvent @event) { Id = @event.AggregateId; _customerName = new CustomerName(@event.CustomerName); _address = new Address(@event.Street, @event.StreetNumber, @event.PostalCode, @event.City); _phoneNumber = new PhoneNumber(@event.PhoneNumber); }
public static Customer CreateNew(Guid id, CustomerName customerName, Address address, PhoneNumber phoneNumber) { return(new Customer(id, customerName, address, phoneNumber)); }
private Customer(Guid id, CustomerName customerName, Address address, PhoneNumber phoneNumber) { RaiseEvent(new CustomerCreatedEvent(id, customerName.Name, address.Street, address.StreetNumber, address.PostalCode, address.City, phoneNumber.Number)); }