public override void Execute() { InstancesDataContext dataContext = new InstancesDataContext(this.ConnectionString); IQueryable <Instance> suspendedInstances = from instance in dataContext.Instances where instance.IsSuspended == true select instance; if (suspendedInstances.ToArray().Length == 0) { Console.WriteLine("No suspendeded instances are found\n"); } else { Console.WriteLine("\r\nQuerying suspended instances\n"); foreach (Instance instance in suspendedInstances) { Console.WriteLine("InstanceId: {0}, SuspensionExceptionName: {1}, SuspensionReason:{2}", instance.InstanceId, instance.SuspensionExceptionName, instance.SuspensionReason); } Console.WriteLine("\r\nQuerying instances is done\n"); } }
public override void Execute() { InstancesDataContext dataContext = new InstancesDataContext(this.ConnectionString); IQueryable<Instance> suspendedInstances = from instance in dataContext.Instances where instance.IsSuspended == true select instance; if (suspendedInstances.ToArray().Length == 0) { Console.WriteLine("No suspendeded instances are found\n"); } else { Console.WriteLine("\r\nQuerying suspended instances\n"); foreach (Instance instance in suspendedInstances) { Console.WriteLine("InstanceId: {0}, SuspensionExceptionName: {1}, SuspensionReason:{2}",instance.InstanceId, instance.SuspensionExceptionName, instance.SuspensionReason); } Console.WriteLine("\r\nQuerying instances is done\n"); } }
public override void Execute() { InstancesDataContext dataContext = new InstancesDataContext(this.ConnectionString); IQueryable<Instance> suspendedInstances = from instance in dataContext.Instances where instance.IsSuspended == true && instance.InstanceId == new Guid(this.instanceId) select instance; if (suspendedInstances.ToArray().Length == 0) { Console.WriteLine("InstanceId {0} is not found\n", this.instanceId); } else { ChannelFactory<IWorkflowInstanceManagement> channelFactory = new ChannelFactory<IWorkflowInstanceManagement>("controlEndpoint"); IWorkflowInstanceManagement proxy = channelFactory.CreateChannel(); proxy.Terminate(new Guid(instanceId), "TerminateReason"); Console.WriteLine("Terminating InstanceId {0} is done\n", this.instanceId); } }
public override void Execute() { InstancesDataContext dataContext = new InstancesDataContext(this.ConnectionString); IQueryable <Instance> suspendedInstances = from instance in dataContext.Instances where instance.IsSuspended == true && instance.InstanceId == new Guid(this.instanceId) select instance; if (suspendedInstances.ToArray().Length == 0) { Console.WriteLine("InstanceId {0} is not found\n", this.instanceId); } else { ChannelFactory <IWorkflowInstanceManagement> channelFactory = new ChannelFactory <IWorkflowInstanceManagement>("controlEndpoint"); IWorkflowInstanceManagement proxy = channelFactory.CreateChannel(); proxy.Unsuspend(new Guid(instanceId)); Console.WriteLine("Resuming InstancesId {0} is done\n", this.instanceId); } }