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
时将返回所有工作流实例。