Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }