/// <summary>
        /// Retrieves the deployment config from file
        /// </summary>
        /// <param name="path">The path of the file</param>
        /// <returns>null if the file does not exist</returns>
        private ScriptExecutorConfiguration GetConfig(string path)
        {
            ScriptExecutorConfiguration retval = null;

            if (File.Exists(path))
            {
                using (StreamReader sr = new StreamReader(path))
                {
                    XmlSerializer xs = new XmlSerializer(typeof(ScriptExecutorConfiguration));
                    retval = (ScriptExecutorConfiguration)xs.Deserialize(sr.BaseStream);
                    sr.Close();
                }
            }

            return(retval);
        }
        /// <summary>
        /// Executes the scripts
        /// </summary>
        /// <returns>False if unsuccessful</returns>
        public override bool Execute()
        {
            ServerConnection connection = null;
            Server           sqlServer  = null;
            Database         database   = null;
            Assembly         thisDLL    = Assembly.GetExecutingAssembly();
            AssemblyName     an         = thisDLL.GetName();

            Utilities.Logger.Init(this);
            Utilities.Logger.LogInformation("Script execution task version : {0}...", an.Version);

            try
            {
                Utilities.Logger.LogInformation(string.Format("Attempting to connect to {0}...", this.sqlInstanceName));
                connection = new ServerConnection(this.sqlInstanceName);

                if (string.IsNullOrEmpty(this.sqlUsername))
                {
                    connection.LoginSecure = true;
                }
                else
                {
                    connection.LoginSecure = false;
                    connection.Login       = this.sqlUsername;
                    connection.Password    = this.sqlPassword;
                }
                connection.Connect();

                sqlServer = new Server(connection);

                database = sqlServer.Databases[this.targetDatabase];

                ScriptExecutorConfiguration config = this.GetConfig(this.configPath);

                ScriptExecutor executor = new ScriptExecutor(sqlServer, database, config);
                executor.OutputCompoundFile = false;

                executor.Progress += new ScriptExecutor.ScriptExecutorEventHandler(this.OnProgress);

                executor.Execute();

                Utilities.Logger.LogInformation(string.Format("Execution of script {0} on {1} complete ...", this.sqlInstanceName, this.targetDatabase));
            }
            catch (FailedOperationException ex)
            {
                SqlException sqlEx = ex.InnerException.InnerException as SqlException;
                if (Utilities.Logger.LogErrorFromException(sqlEx))
                {
                    throw;
                }

                return(false);
            }
            catch (Exception ex)
            {
                if (Utilities.Logger.LogErrorFromException(ex))
                {
                    throw;
                }

                return(false);
            }

            return(true);
        }