Ejemplo n.º 1
0
        public BsonDocument Serialize(Commit commit)
        {
            if (commit == null) throw new ArgumentNullException(nameof(commit));

            return new BsonDocument
            {
                {StreamIdFieldName, commit.StreamId},
                {IndexInStreamFieldName, commit.IndexInStream},
                {IndexInAllStreamsFileName, commit.IndexInAllStreams},
                {EventIndexInStreamFieldName, commit.EventIndexInStreamStartsFrom},
                {EventIndexInAllStreamsFieldName, commit.EventIndexInAllStreamsStartsFrom},
                {EventIdsFieldName, new BsonArray(commit.EventIds)}
            };
        }
Ejemplo n.º 2
0
 private async Task<InsertCommitResult> TryInsertAsync(Commit commit)
 {
     var commitDocument = _commitSerializer.Serialize(commit);
     return await _commitDao.InsertAsync(commitDocument);
 }