public static AccountOwner Create(Guid ownerId, string name) { var accountOwner = new AccountOwner(); var @event = new AccountOwnerCreated(ownerId, name); accountOwner.Apply(@event); accountOwner.Changes.Add(@event); return(accountOwner); }
public void Save(AccountOwner accountOwner) { MartenEventStore.AppendEventsToStream <AccountOwner>(_documentSession, accountOwner.Id, accountOwner.Changes); accountOwner.FlushChanges(); }
public void Add(AccountOwner accountOwner) { MartenEventStore.CreateNewStream <AccountOwner>(_documentSession, accountOwner.Id, accountOwner.Changes); accountOwner.FlushChanges(); }
public AccountOwner Build() => AccountOwner.Create(_id, _name);