예제 #1
0
        protected override void ExecuteTask()
        {
            if (string.IsNullOrWhiteSpace(SqlFileName))
            {
                throw new BuildException("SqlFileName cannot be null or empty.");
            }

            if (!File.Exists(SqlFileName))
            {
                throw new BuildException("File does not exist: " + SqlFileName);
            }

            string fileContents = File.ReadAllText(SqlFileName, Encoding.ASCII);

            if (string.IsNullOrWhiteSpace(fileContents))
            {
                throw new BuildException("Invalid file: " + SqlFileName);
            }

            ConnectionStringLoader    loader            = ConnectionStringLoader.GetInstance();
            DatabaseConnectionStrings connectionStrings = loader.GetConnectionString(Application, ConfigKey);

            fileContents = Regex.Replace(fileContents, ";\\W+COMMIT;\\W+", string.Empty, RegexOptions.Multiline);

            Database database = new Database(connectionStrings.PawnSecConnectionInfo.ConnectionString);

            database.ExecuteNonQuery(fileContents);
        }
        public DatabaseConnectionStrings GetConnectionString(ClxApplication application, ConfigurationKey key)
        {
            DatabaseConnectionStrings connectionStrings = new DatabaseConnectionStrings();

            connectionStrings.PawnSecConnectionInfo  = GetPawnSecDatabaseConfigurationInfo(application, key);
            connectionStrings.CcsOwnerConnectionInfo = GetCcsOwnerDatabaseConfigurationInfo(connectionStrings.PawnSecConnectionInfo);

            return(connectionStrings);
        }