Aracılığıyla paylaş


SqlTrackingQueryOptions Oluşturucu

Tanım

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

public:
 SqlTrackingQueryOptions();
public SqlTrackingQueryOptions ();
Public Sub New ()

Örnekler

Aşağıdaki örnekte sınıfının bir örneğinin oluşturulması gösterilmektedir SqlTrackingQueryOptions . Bu örnek İş Akışı İzleyicisi SDK örneğindendir. Daha fazla bilgi için bkz . İş Akışı İzleyicisi Örneği.

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);
}

Açıklamalar

Aşağıdaki tabloda sınıfın bir örneğinin ilk özellik değerleri gösterilmektedir SqlTrackingQueryOptions .

Özellik Değer
StatusMaxDateTime MaxValue.
StatusMinDateTime MinValue.
TrackingDataItems Boş List<T>bir .
WorkflowStatus Null başvuru (Nothing Visual Basic'te).
WorkflowType Null başvuru (Nothing Visual Basic'te).

Bu değerler çağrısının SqlTrackingQuery.GetWorkflows veritabanında izleme verileri olan her iş akışı örneği için bir SqlTrackingWorkflowInstance nesne döndürmesi gerektiğini belirtir.

Şunlara uygulanır