Inheritance: IConfiguration
Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            var dbDeploy = new Dbdeploy.DbDeployer
            {
                InfoWriter = Console.Out,
                ScriptDirectory = new DirectoryInfo("."),
            };

            try 
            {
                IConfiguration config = new ConfigurationFile();

                dbDeploy.Dbms = config.DbType;
                dbDeploy.ConnectionString = config.DbConnectionString;
                dbDeploy.ChangeLogTableName = config.TableName;
            }
            catch (System.Configuration.ConfigurationException)
            {
                // ignore
            }

            var parser = new Parser();

            try
            {
                // Read arguments from command line
                parser.Parse(args, dbDeploy);

                dbDeploy.Go();
            }
            catch (UsageException ex)
            {
                Console.Error.WriteLine("ERROR: " + ex.Message);
                
                parser.PrintUsage();
            }
            catch (DbDeployException ex)
            {
                Console.Error.WriteLine(ex.Message);

                Environment.Exit(1);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Failed to apply changes: " + ex.Message);
                Console.Error.WriteLine(ex.StackTrace);

                Environment.Exit(2);
            }

            Environment.Exit(0);
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            try
            {
                IConfiguration config = new ConfigurationFile();
                DbmsFactory factory = new DbmsFactory(config.DbType, config.DbConnectionString);
                DatabaseSchemaVersionManager databaseSchemaVersion = new DatabaseSchemaVersionManager(factory, config.DbDeltaSet, config.CurrentDbVersion, config.TableName);

                new ToPrintStreamDeployer(databaseSchemaVersion, new DirectoryInfo("."), Console.Out, factory.CreateDbmsSyntax(), config.UseTransaction, null).DoDeploy(Int32.MaxValue);
            }
            catch (DbDeployException ex)
            {
                Console.Error.WriteLine(ex.Message);
                Environment.Exit(1);
            }

            catch (Exception ex)
            {
                Console.Error.WriteLine("Failed to apply changes: " + ex);
                Console.Error.WriteLine(ex.StackTrace);
                Environment.Exit(2);
            }
        }