Exemple #1
0
        public static WorkflowInstanceCommand CreateWorkflowInstanceCommand(SuspendedInstanceManagementReader reader)
        {
            switch (reader.InstanceCommandType)
            {
            case InstanceCommandType.Query:
                return(new QueryInstanceCommand()
                {
                    ConnectionString = reader.ConnectionString
                });

            case InstanceCommandType.Resume:
                return(new ResumeInstanceCommand(reader.InstanceId)
                {
                    ConnectionString = reader.ConnectionString
                });

            case InstanceCommandType.Terminate:
                return(new TerminateInstanceCommand(reader.InstanceId)
                {
                    ConnectionString = reader.ConnectionString
                });

            default:
                throw new NotSupportedException();
            }
        }
        public static WorkflowInstanceCommand CreateWorkflowInstanceCommand(SuspendedInstanceManagementReader reader)
        {
            switch (reader.InstanceCommandType)
            {
                case InstanceCommandType.Query :
                    return new QueryInstanceCommand() { ConnectionString = reader.ConnectionString };

                case InstanceCommandType.Resume:
                    return new ResumeInstanceCommand(reader.InstanceId) { ConnectionString = reader.ConnectionString };

                case InstanceCommandType.Terminate:
                    return new TerminateInstanceCommand(reader.InstanceId) { ConnectionString = reader.ConnectionString };

                default:
                    throw new NotSupportedException();
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            try
            {
                SuspendedInstanceManagementReader reader = new SuspendedInstanceManagementReader(args, "-", ':');

                WorkflowInstanceCommand command = InstanceCommandSelectorFactory.CreateWorkflowInstanceCommand(reader);

                command.Execute();

                Console.WriteLine("Press <ENTER> to stop");
                Console.ReadLine();
            }
            catch (Exception exception)
            {
                Console.WriteLine("\r\n" + exception.Message);
                string usageMessage = string.Format("\nSyntax:\n{0} -Command:<CommandName> -Server:<ServerName> -Database:<DatabaseName> -InstanceId:<InstanceId>", Process.GetCurrentProcess().ProcessName);
                Console.WriteLine(usageMessage);
                string supportedCommand = string.Format("Supported Command = <Query | Resume| Terminate>");
                Console.WriteLine(supportedCommand);
            }
        }
Exemple #4
0
        static void Main(string[] args)
        {
            try
            {
                SuspendedInstanceManagementReader reader = new SuspendedInstanceManagementReader(args, "-", ':');

                WorkflowInstanceCommand command = InstanceCommandSelectorFactory.CreateWorkflowInstanceCommand(reader);

                command.Execute();

                Console.WriteLine("Press <ENTER> to stop");
                Console.ReadLine();
            }
            catch (Exception exception)
            {
                Console.WriteLine("\r\n" + exception.Message);
                string usageMessage = string.Format("\nSyntax:\n{0} -Command:<CommandName> -Server:<ServerName> -Database:<DatabaseName> -InstanceId:<InstanceId>", Process.GetCurrentProcess().ProcessName);
                Console.WriteLine(usageMessage);
                string supportedCommand = string.Format("Supported Command = <Query | Resume| Terminate>");
                Console.WriteLine(supportedCommand);
            }
        }