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); } }
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; }
static void Main(string[] args) { try { Argument arguments = new Argument(args); if (arguments.Validate()) Work(arguments); } catch (Exception ex) { System.Console.WriteLine(ex.Message); } }
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; }