Example #1
0
        public MySqlCheckpointManager(IMySqlConnection connection, ILogger <MySqlCheckpointManager> logger)
        {
            _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
            _scripts = new Scripts.Scripts();

            _createConnection = connection.Build;
        }
Example #2
0
        public MsSqlCheckpointManager(IOptions <MsSqlEventSourcingOptions> options, ILogger <MsSqlCheckpointManager> logger)
        {
            _options = options.ThrowIfNull(nameof(options)).Value;
            _logger  = logger.ThrowIfNull(nameof(logger));
            _scripts = new Scripts.Scripts(_options.Schema);

            _createConnection = () => new SqlConnection(_options.ConnectionString);
        }
        public PostgresCheckpointManager(IOptions <PostgresEventSourcingOptions> options,
                                         ILogger <PostgresCheckpointManager> logger)
        {
            _options = options.ThrowIfNull(nameof(options)).Value;
            _logger  = logger.ThrowIfNull(nameof(logger));
            _scripts = new Scripts.Scripts(_options.Schema);

            _createConnection = () => new PostgresConnection(options).Build();
        }
Example #4
0
        /// <summary>
        /// Get the sql script stored in the application resources
        /// </summary>
        /// <param name="script"></param>
        /// <returns></returns>
        public string GetScript(Scripts.Scripts script)
        {
            Assembly a = Assembly.GetExecutingAssembly();

            using (Stream resFilestream = a.GetManifestResourceStream("DataLib.Scripts." + script.DescriptionAttr()))
            {
                if (resFilestream != null)
                {
                    StreamReader br = new StreamReader(resFilestream);
                    return(br.ReadToEnd());
                }
            }
            return(string.Empty);
        }