internal MySqlStorage(MySqlConnection existingConnection) { _existingConnection = existingConnection ?? throw new ArgumentNullException("existingConnection"); _options = new MySqlStorageOptions(); InitializeQueueProviders(); }
public MySqlStorage(string connectionString, MySqlStorageOptions options) { if (connectionString == null) { throw new ArgumentNullException("connectionString"); } if (options == null) { throw new ArgumentNullException("options"); } if (IsConnectionString(connectionString)) { _connectionString = connectionString; } else { throw new ArgumentException( string.Format( "Could not find connection string with name '{0}' in application config file", connectionString)); } _options = options; if (options.PrepareSchemaIfNecessary) { using (var connection = CreateAndOpenConnection()) { MySqlObjectsInstaller.Install(connection); } } InitializeQueueProviders(); }
public MySqlStorage(string connectionString, MySqlStorageOptions options) { if (connectionString == null) { throw new ArgumentNullException("connectionString"); } if (options == null) { throw new ArgumentNullException("options"); } if (IsConnectionString(connectionString)) { //if (!connectionString.ToLower().Contains("ignorecommandtransaction")) //{ // if (connectionString.Last() != ';') // { // connectionString += ";IgnoreCommandTransaction=true;"; // } // else // { // connectionString += "IgnoreCommandTransaction=true;"; // } //} if (!connectionString.ToLower().Contains("allowuservariables")) { if (connectionString.Last() != ';') { connectionString += ";allowuservariables=true;"; } else { connectionString += "allowuservariables=true;"; } } _connectionString = connectionString; } else { throw new ArgumentException( string.Format( "Could not find connection string with name '{0}' in application config file", connectionString)); } _options = options; if (options.PrepareSchemaIfNecessary) { using (var connection = CreateAndOpenConnection()) { MySqlObjectsInstaller.Install(connection, options); } } InitializeQueueProviders(); }
public MySqlStorageConnection(MySqlStorage storage, MySqlStorageOptions options) { if (storage == null) { throw new ArgumentNullException("storage"); } _storage = storage; _options = options; }
public CountersAggregator(MySqlStorage storage, MySqlStorageOptions options, TimeSpan interval) { if (storage == null) { throw new ArgumentNullException("storage"); } _storage = storage; _options = options; _interval = interval; }
public MySqlDistributedLock( IDbConnection connection, MySqlStorageOptions options, string resource, TimeSpan timeout, CancellationToken cancellationToken) { Logger.TraceFormat("MySqlDistributedLock resource={0}, timeout={1}", resource, timeout); _resource = resource; _timeout = timeout; _connection = connection; _options = options; _cancellationToken = cancellationToken; _start = DateTime.UtcNow; }
public ExpirationManager(MySqlStorage storage, MySqlStorageOptions options, TimeSpan checkInterval) { if (storage == null) { throw new ArgumentNullException("storage"); } _storage = storage; _options = options; _checkInterval = checkInterval; ProcessedTables = new string[] { "AggregatedCounter", "Job", "List", "Set", "Hash" }; }
public static void Install(MySqlConnection connection, MySqlStorageOptions options) { _options = options; if (connection == null) { throw new ArgumentNullException("connection"); } if (TablesExists(connection)) { Log.Info("DB tables already exist. Exit install"); return; } Log.Info("Start installing Hangfire SQL objects..."); var script = GetStringResource("Hangfire.MySql.Core.Install.sql").Replace("<tableprefix>", options.TablePrefix); connection.Execute(script); Log.Info("Hangfire SQL objects installed."); }
public MySqlDistributedLock(IDbConnection connection, MySqlStorageOptions options, string resource, TimeSpan timeout) : this(connection, options, resource, timeout, new CancellationToken()) { }
public MySqlDistributedLock(MySqlStorage storage, MySqlStorageOptions options, string resource, TimeSpan timeout) : this(storage.CreateAndOpenConnection(), options, resource, timeout) { _storage = storage; }
public ExpirationManager(MySqlStorage storage, MySqlStorageOptions options) : this(storage, options, TimeSpan.FromHours(1)) { }
public static IGlobalConfiguration <MySqlStorage> UseMySqlStorage(this IGlobalConfiguration configuration, string connectionString, MySqlStorageOptions options) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (connectionString == null) { throw new ArgumentNullException(nameof(connectionString)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } var storage = new MySqlStorage(connectionString, options); return(configuration.UseStorage(storage)); }
public MySqlWriteOnlyTransaction(MySqlStorage storage, MySqlStorageOptions options) { _storage = storage ?? throw new ArgumentNullException("storage"); _options = options; }