Aracılığıyla paylaş


StateMachineWorkflowInstance(WorkflowRuntime, Guid) Oluşturucu

Tanım

StateMachineWorkflowInstance sınıfının yeni bir örneğini başlatır.

public:
 StateMachineWorkflowInstance(System::Workflow::Runtime::WorkflowRuntime ^ runtime, Guid instanceId);
public StateMachineWorkflowInstance (System.Workflow.Runtime.WorkflowRuntime runtime, Guid instanceId);
new System.Workflow.Activities.StateMachineWorkflowInstance : System.Workflow.Runtime.WorkflowRuntime * Guid -> System.Workflow.Activities.StateMachineWorkflowInstance
Public Sub New (runtime As WorkflowRuntime, instanceId As Guid)

Parametreler

runtime
WorkflowRuntime

Geçerli iş akışı çalışma zamanı.

instanceId
Guid

örneğini GuidStateMachineWorkflowActivitygösteren.

Özel durumlar

runtime bir null başvurudur (Nothing Visual Basic'te).

veya

instanceId boş Guidbir .

Örnekler

Aşağıdaki örnekte, bir StateMachineWorkflowInstance nesnenin yeni bir örneğinin nasıl oluşturulacağı gösterilmektedir. Bu örnek, Durum Makinesi SDK'sını Sıralama örneğindendir. Daha fazla bilgi için bkz . Durum Makinesi Örneğini Sıralama.

try
{
    List<SqlTrackingWorkflowInstance> queriedWorkflows = new List<SqlTrackingWorkflowInstance>();
    SqlTrackingQuery sqlTrackingQuery = new SqlTrackingQuery(connectionString);
    SqlTrackingQueryOptions sqlTrackingQueryOptions = new SqlTrackingQueryOptions();
    sqlTrackingQueryOptions.StatusMinDateTime = from.ToUniversalTime();
    sqlTrackingQueryOptions.StatusMaxDateTime = until.ToUniversalTime();
    // If QualifiedName, FieldName, or DataValue is not supplied, we will not query since they are all required to match
    if (!((string.Empty == trackingDataItemValue.QualifiedName) || (string.Empty == trackingDataItemValue.FieldName) || ((string.Empty == trackingDataItemValue.DataValue))))
        sqlTrackingQueryOptions.TrackingDataItems.Add(trackingDataItemValue);

    queriedWorkflows.Clear();

    if ("created" == workflowEvent.ToLower(CultureInfo.InvariantCulture))
    {
        sqlTrackingQueryOptions.WorkflowStatus = WorkflowStatus.Created;
        queriedWorkflows.AddRange(sqlTrackingQuery.GetWorkflows(sqlTrackingQueryOptions));
    }
    else if ("completed" == workflowEvent.ToLower(CultureInfo.InvariantCulture))
    {
        sqlTrackingQueryOptions.WorkflowStatus = WorkflowStatus.Completed;
        queriedWorkflows.AddRange(sqlTrackingQuery.GetWorkflows(sqlTrackingQueryOptions));
    }
    else if ("running" == workflowEvent.ToLower(CultureInfo.InvariantCulture))
    {
        sqlTrackingQueryOptions.WorkflowStatus = WorkflowStatus.Running;
        queriedWorkflows.AddRange(sqlTrackingQuery.GetWorkflows(sqlTrackingQueryOptions));
    }
    else if ("suspended" == workflowEvent.ToLower(CultureInfo.InvariantCulture))
    {
        sqlTrackingQueryOptions.WorkflowStatus = WorkflowStatus.Suspended;
        queriedWorkflows.AddRange(sqlTrackingQuery.GetWorkflows(sqlTrackingQueryOptions));
    }
    else if ("terminated" == workflowEvent.ToLower(CultureInfo.InvariantCulture))
    {
        sqlTrackingQueryOptions.WorkflowStatus = WorkflowStatus.Terminated;
        queriedWorkflows.AddRange(sqlTrackingQuery.GetWorkflows(sqlTrackingQueryOptions));
    }
    else if (("all" == workflowEvent.ToLower(CultureInfo.InvariantCulture)) || string.IsNullOrEmpty(workflowEvent))
    {
        sqlTrackingQueryOptions.WorkflowStatus = WorkflowStatus.Created;
        queriedWorkflows.AddRange(sqlTrackingQuery.GetWorkflows(sqlTrackingQueryOptions));

        sqlTrackingQueryOptions.WorkflowStatus = WorkflowStatus.Completed;
        queriedWorkflows.AddRange(sqlTrackingQuery.GetWorkflows(sqlTrackingQueryOptions));

        sqlTrackingQueryOptions.WorkflowStatus = WorkflowStatus.Running;
        queriedWorkflows.AddRange(sqlTrackingQuery.GetWorkflows(sqlTrackingQueryOptions));

        sqlTrackingQueryOptions.WorkflowStatus = WorkflowStatus.Suspended;
        queriedWorkflows.AddRange(sqlTrackingQuery.GetWorkflows(sqlTrackingQueryOptions));

        sqlTrackingQueryOptions.WorkflowStatus = WorkflowStatus.Terminated;
        queriedWorkflows.AddRange(sqlTrackingQuery.GetWorkflows(sqlTrackingQueryOptions));
    }
    return queriedWorkflows;
}
catch (Exception exception)
{
    throw new Exception("Exception in GetWorkflows", exception);
}

Şunlara uygulanır