IgnoreDependencies

Hello,

I'm trying to create a tool that compares only sprocs and would like to ignore dependencies:

C# //Lots of C# (is there a better way to post this much code?)

Options compareOptions = Options.None;
//compareOptions.Plus(Options.Default);
compareOptions.Plus(Options.AddDatabaseUseStatement);
compareOptions.Plus(Options.IgnorePermissions);
compareOptions.Plus(Options.IgnoreUserProperties);
compareOptions.Plus(Options.IgnoreUsers);
compareOptions.Plus(Options.IgnoreComments);
compareOptions.Plus(Options.IgnoreWithNocheck);

Differences sourceVsTarget = sourcedb.CompareWith(targetdb, compareOptions);

int deploycount = 0;
//logic to determine if the object qualifies for release to the "target" system.
//I'm only looking at sprocs.
//no validation on schema or anything else
foreach(Difference diff in sourceVsTarget)
{
//default selected to false (only let StoredProcedures through
diff.Selected = false;

if (Sourceserverandschema.Schema != null && diff.Name.ToUpper().Contains(string.Format("[{0}]", Sourceserverandschema.Schema.ToUpper())))
{
//retval += string.Format("{0} {1} {2} {3}", diff.Type, diff.DatabaseObjectType, diff.Name, Environment.NewLine);
diff.Selected = (diff.DatabaseObjectType == ObjectType.StoredProcedure && diff.Type != DifferenceType.Equal);
}

if (Sourceserverandschema.Schemas != null && Sourceserverandschema.Schemas.Count > 1)
{
foreach (string schema in sourceserverandschema.Schemas)
{
if (diff.Name.ToUpper().Contains(string.Format("[{0}]",schema.ToUpper())))
{
//retval += string.Format("{0} {1} {2} {3}", diff.Type, diff.DatabaseObjectType, diff.Name, Environment.NewLine);
diff.Selected = (diff.DatabaseObjectType == ObjectType.StoredProcedure && diff.Type != DifferenceType.Equal);
}
}
}

//retval = retval.Replace("OnlyIn1", string.Format("{0}.{1}", Sourceserverandschema.Server, Sourceserverandschema.Database));
//retval = retval.Replace("OnlyIn2", string.Format("{0}.{1}", Targetserverandschema.Server, Targetserverandschema.Database));

//select stored procedures and new stuff (for now)
//diff.Selected = (diff.DatabaseObjectType == ObjectType.StoredProcedure);

if (diff.Selected == true)
{
retval += string.Format("{0}.{1} will be released to {2}\n", Sourceserverandschema.Database, diff.Name, Targetserverandschema.Database);
//deployOutput += string.Format("{0}.{1} DEPLOYED TO {2}.{3}\n", Sourceserverandschema.Database, diff.Name, Targetserverandschema.Database, Targetserverandschema.Schema);
deploycount++;
}
}
.:Steve:.
Sign In or Register to comment.