Esempio n. 1
0
        public string GetDataCompare(
            DataCompareConfiguration dataCompareConfiguration
            )
        {
            config = dataCompareConfiguration;
            var sourceDatabase = SqlSchema.GetDatabase(config.SourceServerName, config.SourceDatabaseName);
            var targetDatabase = SqlSchema.GetDatabase(config.TargetServerName, config.TargetDatabaseName);

            var returnScript = new StringBuilder();

            returnScript.AppendLine("-- Source Server Name: " + config.SourceServerName);
            returnScript.AppendLine("-- Source Database Name: " + config.SourceDatabaseName);
            returnScript.AppendLine("-- Target Server Name: " + config.TargetServerName);
            returnScript.AppendLine("-- Target Database Name: " + config.TargetDatabaseName);
            returnScript.AppendLine("-- Run Date: " + DateTime.Now.ToString());
            returnScript.AppendLine();
            returnScript.AppendLine("USE [" + config.TargetDatabaseName + "];");
            returnScript.AppendLine("GO");
            returnScript.AppendLine();

            returnScript.AppendLine(GetDataChanges(sourceDatabase));
            returnScript.AppendLine();
            returnScript.AppendLine("GO");

            return(returnScript.ToString());
        }
Esempio n. 2
0
        public string GetSchemaCompare(
            string sourceServerName,
            string sourceDatabaseName,
            string targetServerName,
            string targetDatabaseName
            )
        {
            var sourceDatabase = SqlSchema.GetDatabase(sourceServerName, sourceDatabaseName);
            var targetDatabase = SqlSchema.GetDatabase(targetServerName, targetDatabaseName);

            var returnScript = new StringBuilder();

            returnScript.AppendLine("-- Source Server Name: " + sourceServerName);
            returnScript.AppendLine("-- Source Database Name: " + sourceDatabaseName);
            returnScript.AppendLine("-- Target Server Name: " + targetServerName);
            returnScript.AppendLine("-- Target Database Name: " + targetDatabaseName);
            returnScript.AppendLine("-- Run Date: " + DateTime.Now.ToString());
            returnScript.AppendLine();
            returnScript.AppendLine("USE [" + targetDatabaseName + "];");
            returnScript.AppendLine("GO");
            returnScript.AppendLine();

            returnScript.AppendLine(GetDatabaseObjects(sourceDatabase, targetDatabase));

            return(returnScript.ToString());
        }