What are the challenges you face when working across database platforms? Take the survey

Write Compare Differences to Scripts Folder

tater9104tater9104 Posts: 2

I am working on a small executable that allows me to check for a difference between a target live database and a script folder and write any differences to that script folder.

For the most part, I see how to do this, but I am unsure how to write the difference back out to the scripts folder.

Here is my code (note my last comment in this code block):

using (Database LiveDB = new Database(), ScriptDB = new Database())

	LiveDB.Register(new ConnectionProperties(userArgs["s"], userArgs["d"], userArgs["u"], userArgs["p"]), Options.Default);

	ReadFromScriptDatabaseInformation ScriptDBInfo = new ReadFromScriptDatabaseInformation();

	ScriptDB.Register(userArgs["t"], ScriptDBInfo, Options.Default);

	Differences LiveVSScripts = LiveDB.CompareWith(ScriptDB, Options.Default ^ Options.IncludeDependencies);

	foreach (Difference tempDiff in LiveVSScripts)
		tempDiff.Selected = true;

	Work work = new Work();

	work.BuildFromDifferences(LiveVSScripts, Options.Default ^ Options.IncludeDependencies, true);

	//Write out any warnings / messages...
	foreach (Message message in work.Messages)

	foreach (Message message in work.Warnings)
	using (ExecutionBlock block = work.ExecutionBlock)

		Console.WriteLine("SQL to synchronize:");

		BlockExecutor executor = new BlockExecutor();
		//What do I do here to write the differnces back out to the scripts file?



Sign In or Register to comment.