public override ProjectTaskProperties ProcessTaskCmdlet()
        {
            SqlConnectionInfo targetConnectionInfo = null;
            List <MigrateSqlServerSqlMIDatabaseInput> selectedDatabases = null;
            BlobShare backupBlobShare = null;
            FileShare backupFileShare = null;

            if (MyInvocation.BoundParameters.ContainsKey(TargetConnection))
            {
                targetConnectionInfo = (SqlConnectionInfo)MyInvocation.BoundParameters[TargetConnection];
                PSCredential cred = (PSCredential)MyInvocation.BoundParameters[TargetCred];
                targetConnectionInfo.UserName = cred.UserName;
                targetConnectionInfo.Password = Decrypt(cred.Password);
            }

            if (MyInvocation.BoundParameters.ContainsKey(SelectedDatabase))
            {
                selectedDatabases
                    = ((MigrateSqlServerSqlMIDatabaseInput[])MyInvocation.BoundParameters[SelectedDatabase]).ToList();
            }

            if (MyInvocation.BoundParameters.ContainsKey(BackupBlobSasUri))
            {
                backupBlobShare = new BlobShare
                {
                    SasUri = MyInvocation.BoundParameters[BackupBlobSasUri] as string
                };
            }

            if (MyInvocation.BoundParameters.ContainsKey(BackupFileShare))
            {
                backupFileShare = (FileShare)MyInvocation.BoundParameters[BackupFileShare];
            }

            var properties = new ValidateMigrationInputSqlServerSqlMITaskProperties
            {
                Input = new ValidateMigrationInputSqlServerSqlMITaskInput
                {
                    TargetConnectionInfo = targetConnectionInfo,
                    SelectedDatabases    = selectedDatabases,
                    BackupBlobShare      = backupBlobShare,
                    BackupFileShare      = backupFileShare
                }
            };

            return(properties);
        }
示例#2
0
        public override ProjectTaskProperties ProcessTaskCmdlet()
        {
            var source = new SqlConnectionInfo();
            var target = new SqlConnectionInfo();
            List <MigrateSqlServerSqlMIDatabaseInput> selectedDatabases = null;
            BlobShare     backupBlobShare   = null;
            FileShare     backupFileShare   = null;
            List <string> selectedAgentJobs = null;
            List <string> selectedLogins    = null;

            source = (SqlConnectionInfo)MyInvocation.BoundParameters[SourceConnection];
            PSCredential sourceCred = (PSCredential)MyInvocation.BoundParameters[SourceCred];

            source.UserName = sourceCred.UserName;
            source.Password = Decrypt(sourceCred.Password);

            target = (SqlConnectionInfo)MyInvocation.BoundParameters[TargetConnection];
            PSCredential targetCred = (PSCredential)MyInvocation.BoundParameters[TargetCred];

            target.UserName = targetCred.UserName;
            target.Password = Decrypt(targetCred.Password);

            if (MyInvocation.BoundParameters.ContainsKey(SelectedDatabase))
            {
                selectedDatabases
                    = ((MigrateSqlServerSqlMIDatabaseInput[])MyInvocation.BoundParameters[SelectedDatabase]).ToList();
            }

            if (MyInvocation.BoundParameters.ContainsKey(BackupBlobSasUri))
            {
                backupBlobShare = new BlobShare
                {
                    SasUri = MyInvocation.BoundParameters[BackupBlobSasUri] as string
                };
            }

            if (MyInvocation.BoundParameters.ContainsKey(BackupFileShare))
            {
                backupFileShare = (FileShare)MyInvocation.BoundParameters[BackupFileShare];
            }

            if (MyInvocation.BoundParameters.ContainsKey(SelectedAgentJobs))
            {
                selectedAgentJobs
                    = ((string[])MyInvocation.BoundParameters[SelectedAgentJobs]).ToList();
            }

            if (MyInvocation.BoundParameters.ContainsKey(SelectedLogins))
            {
                selectedLogins
                    = ((string[])MyInvocation.BoundParameters[SelectedLogins]).ToList();
            }

            var properties = new MigrateSqlServerSqlMITaskProperties
            {
                Input = new MigrateSqlServerSqlMITaskInput
                {
                    SourceConnectionInfo = source,
                    TargetConnectionInfo = target,
                    SelectedDatabases    = selectedDatabases,
                    BackupBlobShare      = backupBlobShare,
                    BackupFileShare      = backupFileShare,
                    SelectedLogins       = selectedLogins,
                    SelectedAgentJobs    = selectedAgentJobs
                }
            };

            return(properties);
        }