SqlTrackingQueryOptions.StatusMinDateTime 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定 DateTime,這個值與 WorkflowStatus 一起用於限制呼叫 SqlTrackingWorkflowInstance 時傳回的 GetWorkflows(SqlTrackingQueryOptions) 物件集合。
public:
property DateTime StatusMinDateTime { DateTime get(); void set(DateTime value); };
public DateTime StatusMinDateTime { get; set; }
member this.StatusMinDateTime : DateTime with get, set
Public Property StatusMinDateTime As DateTime
屬性值
DateTime,指定用於比對工作流程執行個體與 WorkflowStatus 指定之狀態的時段下限。 預設值為 DateTime.MinValue。
範例
下列範例示範設定 StatusMinDateTime 屬性。 這個範例來自<工作流程監視器 SDK>範例。 如需詳細資訊,請參閱 工作流程監視器範例。
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);
}
備註
SqlTrackingQueryOptions 會將 SqlTrackingWorkflowInstance 的呼叫所傳回的 SqlTrackingQuery.GetWorkflows 物件集合限制在具備下列條件的工作流程執行個體:Type 如 WorkflowType 所指定;狀態如 WorkflowStatus 所指定,而且介於 StatusMinDateTime 和 StatusMaxDateTime 指定的範圍內;擷取的資料至少符合 TrackingDataItemValue 指定的其中一個 TrackingDataItems 物件。
DateTime 指定的 StatusMinDateTime 值是內含值。 如需工作流程執行個體之狀態比對方式的詳細資訊,請參閱 WorkflowStatus 屬性。
注意
如果 WorkflowStatus
設定為 null,則 StatusMaxDateTime
和 StatusMinDateTime
會被忽略。 呼叫 GetWorkflows
時會傳回所有工作流程執行個體。