private static string MainExec(string sourceConnectionString, string targerConnectionString, string username = null, string password = null, DacDeployOptions options = null, CancellationTokenSource C_Token = null)
        {
            if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
            {
                using (var impersonator = new ImpersonateIt())
                {
                    impersonator.Impersonate(username, password);

                    return(Process(sourceConnectionString, targerConnectionString, ref options));
                }
            }
            else
            {
                return(Process(sourceConnectionString, targerConnectionString, ref options));
            }
        }
Example #2
0
        public override void Compare()
        {
            if (string.IsNullOrWhiteSpace(this.SourceConString) || string.IsNullOrWhiteSpace(this.TargetConString))
            {
                throw new ArgumentNullException("Source and Target connection string are empty");
            }

            if (Program.CommandArgs.ContainsKey("username") && Program.CommandArgs.ContainsKey("password"))
            {
                using (ImpersonateIt impersonator = new ImpersonateIt())
                {
                    impersonator.Impersonate(
                        Program.CommandArgs["username"].ToString(),
                        Program.CommandArgs["password"].ToString());
                    Start();
                }
            }
            else
            {
                Start();
            }
        }