public MySqlCheckpointManager(IMySqlConnection connection, ILogger <MySqlCheckpointManager> logger) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _scripts = new Scripts.Scripts(); _createConnection = connection.Build; }
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(); }
/// <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); }