public TaskReminderSentEventIndexer(IEventStoreConnection eventStoreConnection, IEventStoreWriter<TaskReminderSentEvent> eventStoreWriter)
        {
            _eventStoreWriter = eventStoreWriter;

            if (!_eventStoreWriter.Initialized)
            {
                _eventStoreWriter.Initialize(
                    connection: eventStoreConnection,
                    stream: e => string.Format("Task-{0}", e.TaskId),
                    eventStoreId: e => e.Id,
                    eventType: e => e.GetType().ToString(),
                    metaData: e => new { IndexedCreatedDate = DateTime.UtcNow },
                    eventData: e => e);
            }
        }
Пример #2
0
        public TaskReminderSentEventIndexer(IEventStoreConnection eventStoreConnection, IEventStoreWriter <TaskReminderSentEvent> eventStoreWriter)
        {
            _eventStoreWriter = eventStoreWriter;

            if (!_eventStoreWriter.Initialized)
            {
                _eventStoreWriter.Initialize(
                    connection: eventStoreConnection,
                    stream: e => string.Format("Task-{0}", e.TaskId),
                    eventStoreId: e => e.Id,
                    eventType: e => e.GetType().ToString(),
                    metaData: e => new { IndexedCreatedDate = DateTime.UtcNow },
                    eventData: e => e);
            }
        }
Пример #3
0
        public GenericEventIndexer(IEventStoreConnection eventStoreConnection, IEventStoreWriter <T> eventStoreWriter)
        {
            _eventStoreWriter = eventStoreWriter;

            if (!_eventStoreWriter.Initialized)
            {
                _eventStoreWriter.Initialize(
                    connection: eventStoreConnection,
                    stream: _stream,
                    eventStoreId: e => e.Id,
                    eventType: e => e.GetType().FullName,
                    metaData: e => e.MetaData,
                    eventData: e => e.JsonData);

                //// Alternative we could control the write action to do custom operations
                //// at point of writing, such as set stream metadata should the stream not
                //// already exist.
                //
                //_eventStoreWriter.Initialize(
                //    eventStoreAction: (e, writeAction) =>
                //    {
                //        eventStoreConnection.SetStreamMetadataAsync(
                //            _stream.Invoke(e),
                //            ExpectedVersion.Any,
                //            StreamMetadata.Build()
                //                .SetReadRole("$all")
                //                .SetWriteRole("$all")
                //                .SetDeleteRole("$all")
                //                .SetMetadataReadRole("$all")
                //                .SetMetadataWriteRole("$all")).Wait();

                //        writeAction.Invoke(eventStoreConnection);
                //    },
                //    stream: _stream,
                //    eventStoreId: e => e.Id,
                //    eventType: e => e.GetType().FullName,
                //    metaData: e => e.MetaData,
                //    eventData: e => e.JsonData);
            }
        }