public void Handle(AccountAddedEvent e) { this.Id = e.AggregateId; this.Version = e.Version; this.CustomerId = e.CustomerId; this.Currency = e.Currency; this.Balance = 0; this.State = e.AccountState; }
public static AccountDomainModel CreateNewInstance( Guid id, Guid customerId, int version, string currency, State accountState) { var @event = new AccountAddedEvent { AggregateId = id, CustomerId = customerId, Version = version, Currency = currency, AccountState = accountState }; var account = new AccountDomainModel(); account.ApplyChange(@event); return account; }