public MySqlStorage(string connectionString, MySqlStorageOptions storageOptions)
        {
            if (connectionString == null)
            {
                throw new ArgumentNullException("connectionString");
            }
            if (storageOptions == null)
            {
                throw new ArgumentNullException("storageOptions");
            }

            if (IsConnectionString(connectionString))
            {
                _connectionString = connectionString;
            }
            else
            {
                throw new ArgumentException(
                          string.Format(
                              "Could not find connection string with name '{0}' in application config file",
                              connectionString));
            }
            _storageOptions = storageOptions;

            if (storageOptions.PrepareSchemaIfNecessary)
            {
                using (var connection = CreateAndOpenConnection())
                {
                    MySqlObjectsInstaller.Install(connection, storageOptions.TablesPrefix);
                }
            }

            InitializeQueueProviders();
        }
Exemplo n.º 2
0
        public MySqlStorage(string nameOrConnectionString, MySqlStorageOptions options)
        {
            if (nameOrConnectionString == null)
            {
                throw new ArgumentNullException("nameOrConnectionString");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if (IsConnectionString(nameOrConnectionString))
            {
                _connectionString = nameOrConnectionString;
            }
            else if (IsConnectionStringInConfiguration(nameOrConnectionString))
            {
                _connectionString = ConfigurationManager.ConnectionStrings[nameOrConnectionString].ConnectionString;
            }
            else
            {
                throw new ArgumentException(
                          string.Format(
                              "Could not find connection string with name '{0}' in application config file",
                              nameOrConnectionString));
            }

            /*if (!_connectionString.Contains("Use Affected Rows"))
             * {
             *  _connectionString = _connectionString.TrimEnd(' ', ';') + ";Use Affected Rows=true";
             * }*/
            _options = options;

            if (options.PrepareSchemaIfNecessary)
            {
                using (var connection = CreateAndOpenConnection())
                {
                    MySqlObjectsInstaller.Install(connection);
                }
            }

            InitializeQueueProviders();
        }
        public MySqlStorage(string nameOrConnectionString, MySqlStorageOptions options)
        {
            if (nameOrConnectionString == null)
            {
                throw new ArgumentNullException("nameOrConnectionString");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if (IsConnectionString(nameOrConnectionString))
            {
                _connectionString = ApplyAllowUserVariablesProperty(nameOrConnectionString);
            }
            else if (IsConnectionStringInConfiguration(nameOrConnectionString))
            {
                _connectionString =
                    ApplyAllowUserVariablesProperty(
                        ConfigurationManager.ConnectionStrings[nameOrConnectionString].ConnectionString);
            }
            else
            {
                throw new ArgumentException(
                          string.Format(
                              "Could not find connection string with name '{0}' in application config file",
                              nameOrConnectionString));
            }
            _options = options;

            if (options.PrepareSchemaIfNecessary)
            {
                using (var connection = CreateAndOpenConnection())
                {
                    MySqlObjectsInstaller.Install(connection);
                }
            }

            InitializeQueueProviders();
        }
Exemplo n.º 4
0
        public MySqlStorage(string nameOrConnectionString, MySqlStorageOptions options)
        {
            if (nameOrConnectionString == null)
            {
                throw new ArgumentNullException("nameOrConnectionString");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            _connectionString = ApplyAllowUserVariablesProperty(nameOrConnectionString);
            _options          = options;

            if (options.PrepareSchemaIfNecessary)
            {
                using (var connection = CreateAndOpenConnection())
                {
                    MySqlObjectsInstaller.Install(connection);
                }
            }

            InitializeQueueProviders();
        }