| Author |
Message |
OJ
Joined: 11 Jun 2010 Posts: 2
|
Posted: Fri Jun 11, 2010 11:54 am Post subject: How to avoid saving replication triggers to folder? |
|
|
I'm trying to use the Compare SDK to save my database objects to a disk folder. However I do not want replication triggers included. Have tried with Options.IgnoreReplicationTriggers (see below) but it does not seem have any effect.
Is this possible at all??
| Code: |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RedGate.SQLCompare.Engine;
using RedGate.SQLCompare.Engine.ReadFromFolder;
namespace SourceGrabber
{
class Program
{
static void Main(string[] args)
{
RedGate.SQLCompare.Engine.Database db;
using (db = new Database())
{
db.Register(new ConnectionProperties(@"TheServer", "TheDatabase"), Options.Default | Options.IgnoreReplicationTriggers);
db.SaveToFolder(@"TheDiskFolder", new WriteToFileOptions());
}
}
}
}
|
|
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6343 Location: Red Gate Software
|
Posted: Mon Jun 14, 2010 5:26 pm Post subject: |
|
|
Hi OJ,
It looks like you have to compare the database to the script folder and then merge the changes in order to skip the replication trigger. Loading the database and saving it to disk doesn't seem to respect options.
| Code: |
private const string c_WidgetProductionFolder = @"c:\users\me\My Documents\schema folders\widgetProduction";
widgetProduction.Register(new ConnectionProperties(".", @"widgetProduction"), Options.Default | Options.IgnoreReplicationTriggers);
Database wpScripts = new Database();
wpScripts.Register(c_WidgetProductionFolder, null, Options.Default | Options.IgnoreReplicationTriggers);
Differences diffs=widgetProduction.CompareWith(wpScripts, Options.Default | Options.IgnoreReplicationTriggers);
Work work = new Work();
ScriptSynchronizationActions actions = new ScriptSynchronizationActions();
work.BuildFromDifferences(diffs, Options.Default | Options.IgnoreReplicationTriggers, true);
ScriptSynchronizationActions scriptActions = work.ScriptSynchronizationActions;
scriptActions.Execute(); |
_________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
OJ
Joined: 11 Jun 2010 Posts: 2
|
Posted: Tue Jun 15, 2010 9:14 am Post subject: |
|
|
Thanks for your reply Brian. Your work around should work.
However I concider it a defect, that the Register method does not respect the Options passed in. |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group