SqlTrackingQueryOptions.WorkflowStatus Propriedade
Definição
Obtém ou define o valor WorkflowStatus que é usado para restringir o conjunto de objetos SqlTrackingWorkflowInstance retornados por uma chamada para GetWorkflows(SqlTrackingQueryOptions).Gets or sets the WorkflowStatus value that is used to constrain the set of SqlTrackingWorkflowInstance objects returned by a call to GetWorkflows(SqlTrackingQueryOptions).
public:
property Nullable<System::Workflow::Runtime::WorkflowStatus> WorkflowStatus { Nullable<System::Workflow::Runtime::WorkflowStatus> get(); void set(Nullable<System::Workflow::Runtime::WorkflowStatus> value); };
public System.Workflow.Runtime.WorkflowStatus? WorkflowStatus { get; set; }
member this.WorkflowStatus : Nullable<System.Workflow.Runtime.WorkflowStatus> with get, set
Public Property WorkflowStatus As Nullable(Of WorkflowStatus)
Valor da propriedade
Um dos WorkflowStatus valores ou NULL ( Nothing em Visual Basic).One of the WorkflowStatus values or null (Nothing in Visual Basic). O padrão é NULL ( Nothing ).The default is null (Nothing).
Exemplos
O exemplo a seguir demonstra a definição da propriedade WorkflowStatus.The following example demonstrates setting the WorkflowStatus property. Este exemplo é do exemplo de SDK do monitor de fluxo de trabalho.This example is from the Workflow Monitor SDK sample. Para obter mais informações, consulte exemplo de monitor de fluxo de trabalho.For more information, see Workflow Monitor Sample.
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);
}
Comentários
SqlTrackingQueryOptions restringe o conjunto de SqlTrackingWorkflowInstance objetos retornados por uma chamada para SqlTrackingQuery.GetWorkflows para as instâncias de fluxo de trabalho que têm o Type especificado por WorkflowType , que têm o status especificado pelo WorkflowStatus durante o período especificado por StatusMinDateTime e e StatusMaxDateTime que extrairam dados que correspondem a pelo menos um dos TrackingDataItemValue objetos especificados por TrackingDataItems .SqlTrackingQueryOptions constrains the set of SqlTrackingWorkflowInstance objects returned by a call to SqlTrackingQuery.GetWorkflows to those workflow instances that have the Type specified by WorkflowType, that have the status specified by WorkflowStatus during the period specified by StatusMinDateTime and StatusMaxDateTime, and that have extracted data that matches at least one of the TrackingDataItemValue objects specified by TrackingDataItems.
Uma instância de fluxo de trabalho é considerada com um status que corresponde WorkflowStatus se a última WorkflowTrackingRecord recebida para essa instância de fluxo de trabalho antes ou durante o período de tempo especificado tem sua WorkflowTrackingRecord.TrackingWorkflowEvent propriedade definida como um TrackingWorkflowEvent valor que é mapeado para o System.Workflow.Runtime.WorkflowStatus valor especificado por WorkflowStatus .A workflow instance is considered to have a status that matches WorkflowStatus if the last WorkflowTrackingRecord received for that workflow instance before or during the specified time period has its WorkflowTrackingRecord.TrackingWorkflowEvent property set to a TrackingWorkflowEvent value that maps to the System.Workflow.Runtime.WorkflowStatus value specified by WorkflowStatus. Portanto, o TrackingProfile para a instância de fluxo de trabalho deve ter um WorkflowTrackPoint que esteja configurado para o System.Workflow.Runtime.Tracking.TrackingWorkflowEvent valor apropriado.Therefore, the TrackingProfile for the workflow instance must have a WorkflowTrackPoint that is configured for the appropriate System.Workflow.Runtime.Tracking.TrackingWorkflowEvent value. Somente TrackingWorkflowEvent os valores que foram enviados nos registros de rastreamento de fluxo de trabalho podem ser correspondidos.Only TrackingWorkflowEvent values that have been sent in workflow tracking records can be matched. Se nenhum registro de rastreamento de fluxo de trabalho for enviado para a instância de fluxo de trabalho, a instância de fluxo de trabalho será considerada como tendo um status WorkflowStatus.Created .If no workflow tracking records have been sent for the workflow instance, the workflow instance is considered to have a status of WorkflowStatus.Created.
A tabela a seguir mostra o mapeamento entre TrackingWorkflowEvent valores e valor WorkflowStatus .The following table shows the mapping between TrackingWorkflowEvent values and WorkflowStatus values.
| Valor de TrackingWorkflowEventTrackingWorkflowEvent value | Valor de WorkflowStatusWorkflowStatus value |
|---|---|
| Aborted | Running |
| Changed | Running |
| Completed | Completed |
| Created | Created |
| Exception | Running |
| Idle | Running |
| Loaded | Running |
| Persisted | Running |
| Resumed | Running |
| Started | Running |
| Suspended | Suspended |
| Terminated | Terminated |
| Unloaded | Running |
Se WorkflowStatus for NULL ( Nothing ), o conjunto de SqlTrackingWorkflowInstance objetos retornado não será restrito por status; em outras palavras, um SqlTrackingWorkflowInstance objeto será retornado para qualquer instância de fluxo de trabalho que corresponda aos parâmetros especificados pelas outras propriedades de SqlTrackingQueryOptions .If WorkflowStatus is null (Nothing), the set of SqlTrackingWorkflowInstance objects returned will not be constrained by status; in other words, a SqlTrackingWorkflowInstance object will be returned for any workflow instance that matches the parameters specified by the other properties of SqlTrackingQueryOptions.