Example #1
0
        /// <summary>
        ///     The main entry point into the application.
        /// </summary>
        /// <param name="args">The arguments for this run</param>
        /// <exception cref="System.ArgumentException"></exception>
        private static void Main(string[] args)
        {
            try
            {
                ConfigurationService = Container.UnityContainer.Resolve <IConfigurationService>();
                DeploymentService    = Container.UnityContainer.Resolve <IDeploymentService>();

                ConfigurationService.ConnectionString = GetSetting <string>("ConnectionString");

                switch (GetSetting <string>("DatabaseType"))
                {
                case "mssql":
                    ConfigurationService.DatabaseManagementSystem = DatabaseTypesEnum.SqlServer;
                    break;

                case "ora":
                    ConfigurationService.DatabaseManagementSystem = DatabaseTypesEnum.Oracle;
                    break;

                case "mysql":
                    ConfigurationService.DatabaseManagementSystem = DatabaseTypesEnum.MySql;
                    break;

                default:
                    string message =
                        string.Format(
                            "An invalid database type of {0} was specified.  Only \"mssql\", \"ora\", and \"mysql\" are supported.",
                            GetSetting <string>("DatabaseType"));
                    Log.Fatal(message);
                    throw new ArgumentException(message);
                }

                ConfigurationService.LastChangeToApply = GetSetting <int>("LastChangeToApply");
                ConfigurationService.OutputFile        = GetSetting <string>("OutputFile");
                ConfigurationService.Recursive         = GetSetting <bool>("Recursive");
                ConfigurationService.RootDirectory     = GetSetting <string>("RootDirectory");
                ConfigurationService.SearchPattern     = GetSetting <string>("SearchPattern");
                ConfigurationService.FileNamePattern   = GetSetting <string>("FileNamePattern");
                ConfigurationService.UndoOutputFile    = GetSetting <string>("UndoFile");
                ConfigurationService.Schema            = GetSetting <string>("Schema");
                ConfigurationService.ChangeLog         = GetSetting <string>("ChangeLog");

                ParseCommandLine(args);

                DeploymentService.BuildDeploymentScript();
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
Example #2
0
        /// <summary>
        /// The main entry point into the application.
        /// </summary>
        /// <param name="args">
        /// The arguments for this run
        /// </param>
        private static void Main(string[] args)
        {
            if (log.IsDebugEnabled)
            {
                log.Debug(LogUtility.GetContext(args));
            }

            try
            {
                Container.UnityContainer.RegisterType <IConfigurationService>(new PerThreadLifetimeManager());

                ConfigurationService = Container.UnityContainer.Resolve <IConfigurationService>();
                DeploymentService    = Container.UnityContainer.Resolve <IDeploymentService>();

                ConfigurationService.ConnectionString = GetSetting <string>("ConnectionString");

                switch (GetSetting <string>("DatabaseType"))
                {
                case "mssql":
                    ConfigurationService.DatabaseManagementSystem = DatabaseTypesEnum.SqlServer;
                    break;

                case "ora":
                    ConfigurationService.DatabaseManagementSystem = DatabaseTypesEnum.Oracle;
                    break;

                case "mysql":
                    ConfigurationService.DatabaseManagementSystem = DatabaseTypesEnum.MySql;
                    break;

                default:
                    string message = string.Format("An invalid database type of {0} was specified.  Only \"mssql\", \"ora\", and \"mysql\" are supported (and only mssql will work at this time).", GetSetting <string>("DatabaseType"));
                    log.Fatal(message);
                    throw new ArgumentException(message);
                }

                ConfigurationService.LastChangeToApply = GetSetting <int>("LastChangeToApply");
                ConfigurationService.OutputFile        = GetSetting <string>("OutputFile");
                ConfigurationService.Recursive         = GetSetting <bool>("Recursive");
                ConfigurationService.RootDirectory     = GetSetting <string>("RootDirectory");
                ConfigurationService.SearchPattern     = GetSetting <string>("SearchPattern");
                ConfigurationService.UndoOutputFile    = GetSetting <string>("UndoFile");

                DeploymentService.BuildDeploymentScript();
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }