public Customer(Guid customerId, string name, DateTime? birthDate) { EventSourceId = customerId; if (!GenericValidationRules.ValidName(name)) throw new InvalidDataException("name not valid."); var e = new CustomerCreated{ CustomerId = customerId, Name = name, BirthDate = birthDate }; ApplyEvent(e); }
private void OnCreated(CustomerCreated e) { _name = e.Name; _birthDate = e.BirthDate; }