示例#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);
			}
		}
		public override String Process(SysDatabase source, SysDatabase target)
		{
		    try
			{
				var generator = new DbTableScriptGenerator();
				{
					var script = generator.GenerateSingleObjectSyncScript(source, target);
					if (!String.IsNullOrEmpty(script))
					{
						script = String.Format("USE [{0}]{1}{1}{2}", target.Name, Environment.NewLine, script);
						GenerateFile(script);
					}
				}

				return Resources.OperationMessages.TableSyncSuccess;
			}
		    catch (Exception ex)
		    {			        
				Error = true;
				return ex.Message;
		    }
		}