Exemple #1
0
        static void Work(Argument arguments)
        {
            try
            {
                DBDiff.Schema.SQLServer.Generates.Model.Database origen;
                DBDiff.Schema.SQLServer.Generates.Model.Database destino;
                if (TestConnection(arguments.ConnectionString1, arguments.ConnectionString2))
                {
                    Generate sql = new Generate();
                    SqlOption opt = new SqlOption(true);
                    opt.Ignore.FilterSchema = false;
                    opt.Ignore.FilterUsers = false;
                    opt.Ignore.FilterTableFileGroup = false;
                    sql.Options = opt;
                    sql.ConnectionString = arguments.ConnectionString1;
                    System.Console.WriteLine("Reading first database...");
                    //sql.Options = SqlFilter;
                    origen = sql.Process();                    

                    sql.ConnectionString = arguments.ConnectionString2;
                    System.Console.WriteLine("Reading second database...");
                    destino = sql.Process();
                    System.Console.WriteLine("Comparing databases schemas...");
                    origen = Generate.Compare(origen, destino);
                    System.Console.WriteLine("Generating SQL file...");
                    SaveFile(arguments.OutputFile, origen.ToSql());
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.Message);
            }
        }
Exemple #2
0
        static bool Work(Argument arguments)
        {
            bool completedSuccessfully = false;
            try
            {
                DBDiff.Schema.SQLServer.Generates.Model.Database origen;
                DBDiff.Schema.SQLServer.Generates.Model.Database destino;
                if (TestConnection(arguments.ConnectionString1, arguments.ConnectionString2))
                {
                    Generate sql = new Generate();
                    sql.ConnectionString = arguments.ConnectionString1;
                    System.Console.WriteLine("Reading first database...");
                    sql.Options = SqlFilter;
                    origen = sql.Process();

                    sql.ConnectionString = arguments.ConnectionString2;
                    System.Console.WriteLine("Reading second database...");
                    destino = sql.Process();
                    System.Console.WriteLine("Comparing databases schemas...");
                    origen = Generate.Compare(origen, destino);
                    System.Console.WriteLine("Generating SQL file...");
                    SaveFile(arguments.OutputFile, arguments.OutputAll ? origen.ToSql() : origen.ToSqlDiff().ToSQL());
                    completedSuccessfully = true;
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(String.Format("{0}\r\n{1}\r\n\r\nPlease report this issue at http://opendbiff.codeplex.com/workitem/list/basic\r\n\r\n", ex.Message, ex.StackTrace));
            }

            return completedSuccessfully;
        }
Exemple #3
0
 static void Main(string[] args)
 {
     try
     {
         Argument arguments = new Argument(args);
         if (arguments.Validate())
             Work(arguments);
     }
     catch (Exception ex)
     {
         System.Console.WriteLine(ex.Message);
     }
 }
Exemple #4
0
        static int Main(string[] args)
        {
            bool completedSuccessfully = false;
            try
            {
                Argument arguments = new Argument(args);
                if (arguments.Validate())
                    completedSuccessfully = Work(arguments);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return completedSuccessfully ? 0 : 1;
        }