Exemplo n.º 1
0
		private void GenerateForTables(SysDatabase sourceDb, SysDatabase targetDb)
		{
			var script = new DbTableScriptGenerator().GenerateSingleObjectSyncScript(sourceDb, targetDb);

			if (!String.IsNullOrEmpty(script))
			{
				script = String.Format("USE [{0}]{1}{1}{2}", targetDb.Name, Environment.NewLine, script);
				System.IO.File.WriteAllText(String.Format(@"{0}\{1}_{2}.sql", _directory, "TableScript", _dateStamp), script);
			}
		}
Exemplo n.º 2
0
		private Boolean LoadAllDatabases()
		{			
			try
			{
				Output(Resources.UserMessages.LoadingDatabases);

				_sourceDb = LoadDB(ddlSourceConn);
				_targetDb = LoadDB(ddlTargetConn);

				Output(Resources.UserMessages.DatabaseLoadSuccessful);
				
				return true;
			}
			catch (Exception ex)
			{
				Output(string.Format(Resources.ErrorMessages.LoadFailedFormatted, ex.Message), true);
				return false;
			}
		}
		public override String Process(SysDatabase source, SysDatabase target)
		{
		    try
			{
				var generator = new TableForeignKeyScriptGenerator();
				{
					var script = generator.GenerateAllObjectsSyncScript(source.Tables, target.Tables);
					if (!String.IsNullOrEmpty(script))
					{
						script = String.Format("USE [{0}]{1}{1}{2}", target.Name, Environment.NewLine, script);
						GenerateFile(script);
					}
				}

				return Resources.OperationMessages.ForeignKeySyncSuccess;
			}
		    catch (Exception ex)
		    {				
				Error = true;
				return ex.Message;
		    }
		 }
Exemplo n.º 4
0
		// TODO: this should just take in a script string (or script object?) and output it. Generation should happen elsewhere.
		public void Generate(SysDatabase sourceDb, SysDatabase targetDb)
		{
			GenerateForColumns(sourceDb, targetDb);
			GenerateForTables(sourceDb, targetDb);
		}