Exemplo n.º 1
0
        public void Store(StoredEvent theEvent)
        {
            var point = new Point()
            {
                Name = TableName,
                Tags = new Dictionary <string, object>()
                {
                    { "AggregateId", theEvent.EventId }
                },
                Fields = new Dictionary <string, object>()
                {
                    { "Data", theEvent.Data },
                    { "EventType", theEvent.EventType },
                    { "Creator", theEvent.Creator },
                    { "Version", theEvent.Version }
                },
                Timestamp = theEvent.Timestamp
            };

            var result = dbContext.WriteAsync(point).Result;

            if (!result.Success)
            {
                throw new InfluxDataException("事件插入失败");
            }
        }
Exemplo n.º 2
0
        public void SaveMemento(Memento memento)
        {
            var point = new Point()
            {
                Name = TableName,
                Tags = new Dictionary <string, object>()
                {
                    { "AggregateId", memento.AggregateId }
                },
                Fields = new Dictionary <string, object>()
                {
                    { "Data", memento.Data },
                    { "Version", memento.Version }
                },
                Timestamp = memento.Timestamp
            };

            var result = dbContext.WriteAsync(point).Result;

            if (!result.Success)
            {
                throw new InfluxDataException("事件插入失败");
            }
        }