示例#1
0
        private static void ConnectToEventStore()
        {
            EventStore = EventStoreFactory.CreateEventStore();
            string connectionString = "tcp://" + ConfigManager.ServiceDiscovery.EventStoreUrl + ":" + ConfigManager.ServiceDiscovery.EventStoreTcpPort;

            EventStore.Connect(connectionString, ConfigManager.ServiceDiscovery.EventStoreUser,
                               ConfigManager.ServiceDiscovery.EventStorePassword,
                               ConfigManager.ServiceDiscovery.EventStoreCommonName,
                               false, ConfigManager.ServiceDiscovery.EventStoreReconnectionAttempts,
                               ConfigManager.EventStoreHeartbeatInterval, ConfigManager.EventStoreHeartbeatTimeout);
        }
    void main()
    {
        IEventStore   eventStore   = new EventStore();
        IEventStreams eventStreams = eventStore.Connect();

        var stream = eventStreams["aggregate-1"];

        eventStreams.Categories();
        eventStreams.StreamsInCategory("aggregate");


        stream.Add(events);
        stream.ToObject <Engagement>((event, engagement) => engagement.Apply(event));