コード例 #1
0
        /// <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);
        }
コード例 #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>
        public EventSourceVersions(
            EventSourceVersionsConfiguration configuration,
            IEventStore eventStore,
            IApplicationResourceIdentifierConverter applicationResourceIdentifierConverter)
        {
            _applicationResourceIdentifierConverter = applicationResourceIdentifierConverter;
            _eventStore = eventStore;

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

            _database = redis.GetDatabase();
        }