/// <summary>
        /// Configure <see cref="IEventSequenceNumbers"/> to be using Redis
        /// </summary>
        /// <param name="eventSourceVersionsConfiguration"><see cref="EventSequenceNumbersConfiguration">Configuration instance</see> to configure</param>
        /// <param name="connectionStrings"><see cref="string">string or strings</see> representing connectionstrings according to StackExchange.Redis</param>
        /// <returns>Chained <see cref="EventSequenceNumbersConfiguration"/></returns>
        public static EventSourceVersionsConfiguration UsingRedis(this EventSourceVersionsConfiguration eventSourceVersionsConfiguration, params string[] connectionStrings)
        {
            eventSourceVersionsConfiguration.EventSourceVersions = typeof(EventSourceVersions);
            var configuration = new Redis.EventSourceVersionsConfiguration(connectionStrings);

            Configure.Instance.Container.Bind(configuration);
            return(eventSourceVersionsConfiguration);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of <see cref="EventSourceVersions"/>
        /// </summary>
        /// <param name="configuration"><see cref="EventSourceVersionsConfiguration">Configuration</see></param>
        /// <param name="eventStore"><see cref="IEventStore"/> for getting information if not in the database</param>
        /// <param name="applicationResourceIdentifierConverter">Converter for converting <see cref="IApplicationResourceIdentifier"/> "/></param>
        /// <param name="logger"><see cref="ILogger"/> to use for logging</param>
        public EventSourceVersions(
            EventSourceVersionsConfiguration configuration,
            IEventStore eventStore,
            IApplicationResourceIdentifierConverter applicationResourceIdentifierConverter,
            ILogger logger)
        {
            _applicationResourceIdentifierConverter = applicationResourceIdentifierConverter;
            _logger     = logger;
            _eventStore = eventStore;

            var redis = ConnectionMultiplexer.Connect(string.Join(";", configuration.ConnectionStrings));

            _database = redis.GetDatabase();
        }