/// <inheritdoc /> /// <summary> /// Initializes a new instance of <see cref="T:SqlStreamStore.MySqlStreamStore" /> /// </summary> /// <param name="settings">A settings class to configure this instance.</param> public MySqlStreamStore(MySqlStreamStoreSettings settings) : base(settings.GetUtcNow, settings.LogName) { _settings = settings; _createConnection = () => { var connection = _settings.ConnectionFactory(_settings.ConnectionString); connection.StateChange += ConnectionOnStateChange; return(connection); void ConnectionOnStateChange(object sender, StateChangeEventArgs e) { Logger.Info(e.ToString); } }; _streamStoreNotifier = new Lazy <IStreamStoreNotifier>(() => { if (_settings.CreateStreamStoreNotifier == null) { throw new InvalidOperationException( "Cannot create notifier because supplied createStreamStoreNotifier was null"); } return(settings.CreateStreamStoreNotifier.Invoke(this)); }); _schema = new Schema(); }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of <see cref="T:SqlStreamStore.MySqlStreamStore" /> /// </summary> /// <param name="settings">A settings class to configure this instance.</param> public MySqlStreamStore(MySqlStreamStoreSettings settings) : base(settings.GetUtcNow, settings.LogName) { _settings = settings; _createConnection = () => _settings.ConnectionFactory(_settings.ConnectionString); _streamStoreNotifier = new Lazy <IStreamStoreNotifier>(() => { if (_settings.CreateStreamStoreNotifier == null) { throw new InvalidOperationException( "Cannot create notifier because supplied createStreamStoreNotifier was null"); } return(settings.CreateStreamStoreNotifier.Invoke(this)); }); _schema = new Schema(); }