public async Task Append(string tenantId, Guid entityId, Guid commitId, params object[] events) { tenantId.MustNotBeEmpty(); entityId.MustNotBeDefault(); commitId.MustNotBeDefault(); if (events.IsNullOrEmpty()) { return; } var commit = new UnversionedCommit(tenantId, entityId, Utils.PackEvents(events), commitId, DateTimeOffset.Now); var dbgInfo = new{ tenantId, entityId, commitId }; EventStore.Logger.Debug("Appending {@commit} with events {@events}", dbgInfo, events); var rez = await _store.Append(commit); if (rez.WasSuccessful) { EventStore.Logger.Debug("Append succesful for commit {@commit}", dbgInfo); return; } throw new DuplicateCommitException(commitId, Utils.UnpackEvents(commit.Timestamp, commit.EventData, _settings.EventMappers)); }
public Commit(int version, UnversionedCommit comm) : this(comm.TenantId, comm.EntityId, comm.EventData, comm.CommitId, comm.Timestamp, version) { }