Ejemplo n.º 1
0
        public object GetDynamicParameters()
        {
            RuntimeDefinedParameterDictionary dynamicParams = null;

            if (CommandType.Equals(CommandTypeEnum.Complete.ToString()))
            {
                commandCmdlet = new CompleteCommandCmdlet(this.MyInvocation);
            }
            else
            {
                throw new PSArgumentException();
            }

            dynamicParams = commandCmdlet.RuntimeDefinedParams;

            return(dynamicParams);
        }
        public object GetDynamicParameters()
        {
            // make sure the commands are relate to the project type, so read project to ensure right method to invoke.
            Project resp = this.DataMigrationClient.Projects.Get(ResourceGroupName, ServiceName, ProjectName);
            RuntimeDefinedParameterDictionary dynamicParams = null;
            string cmd = string.IsNullOrWhiteSpace(CommandType) ? " " : CommandType.ToLowerInvariant();

            if (resp.SourcePlatform.ToLowerInvariant() == "mongodb")
            {
                commandCmdlet = new MongoDbObjectCommandCmdlet(this.MyInvocation, cmd);
            }
            else
            {
                commandCmdlet = new CompleteCommandCmdlet(this.MyInvocation);
            }

            dynamicParams = commandCmdlet.RuntimeDefinedParams;
            return(dynamicParams);
        }
        public new object GetDynamicParameters()
        {
            RuntimeDefinedParameterDictionary dynamicParams = null;

            if (commandTypeSet)
            {
                CommandTypeEnum type = CommandType;
                switch (type)
                {
                case CommandTypeEnum.CompleteSqlDBSync:
                    commandCmdlet = new CompleteCommandCmdlet(this.MyInvocation);
                    break;

                case CommandTypeEnum.CancelMongoDB:
                    commandCmdlet = new MongoDbObjectCommandCmdlet(this.MyInvocation, CommandTypeEnum.CancelMongoDB);
                    break;

                case CommandTypeEnum.RestartMongoDB:
                    commandCmdlet = new MongoDbObjectCommandCmdlet(this.MyInvocation, CommandTypeEnum.RestartMongoDB);
                    break;

                case CommandTypeEnum.FinishMongoDB:
                    commandCmdlet = new MongoDbObjectCommandCmdlet(this.MyInvocation, CommandTypeEnum.FinishMongoDB);
                    break;

                case CommandTypeEnum.CompleteSqlMiSync:
                    commandCmdlet = new CompleteMiSyncCommandCmdlet(this.MyInvocation);
                    break;

                default:
                    throw new PSArgumentException();
                }

                dynamicParams = commandCmdlet.RuntimeDefinedParams;
            }

            return(dynamicParams);
        }