Exemple #1
0
        public void Start()
        {
            _eventStore = new SqlEventStore(() => EventStoreDbContext.Create());

            //_eventStore = new EventStore();

            _eventPublisher        = new EventPublisher(_bus);
            _notificationPublisher = new NotificationPublisher(_bus);

            _repository = new MyRepository(_eventStore, _eventPublisher);
            _session    = new MySession(_repository);

            //_repository = new Repository(_eventStore, _eventPublisher);
            //_session = new Session(_repository);

            _ndch = new NetworkDeviceCommandHandler(_session, _notificationPublisher);
            _ndvb = new NetworkDeviceViewBuilder();

            _bus.SubscribeHandler <CreateNetworkDevice>(_ndch.Handle);
            _bus.SubscribeHandler <ChangeNetworkDeviceHostName>(_ndch.Handle);
            _bus.SubscribeHandler <NetworkDeviceSetStatus>(_ndch.Handle);

            _bus.SubscribeHandler <NetworkDeviceCreated>(_ndvb.Handle);
            _bus.SubscribeHandler <NetworkDeviceHostnameChanged>(_ndvb.Handle);
            _bus.SubscribeHandler <NetworkDeviceOnlineStatusChanged>(_ndvb.Handle);
        }
Exemple #2
0
        static void RunRebuilder()
        {
            Console.WriteLine("Running rebuilder. Please wait...");
            NetworkDeviceViewBuilder viewBuilder = new NetworkDeviceViewBuilder();

            EventStoreDbContext eventContext = new EventStoreDbContext();

            IEventStore eventStore = new SqlEventStore(() => EventStoreDbContext.Create());
            
            foreach (var aggregate in eventContext.Aggregates)
            {
                List<IEvent> events = new List<IEvent>();
                foreach (var evt in eventStore.Get(aggregate.AggregateId, -1))
                {
                    events.Add(evt);
                }

                foreach (var evt in events)
                {
                    
                }

            }

        }