Add IsWorkflowDefinitionActivity method to ActivityExtensions

A new method, GetIsWorkflowDefinitionActivity, has been added to the ActivityExtensions class. This method checks a given JsonObject representing an activity to determine if it's a workflow definition activity. It returns true if the activity indeed is; otherwise, it returns false.
This commit is contained in:
Sipke Schoorstra 2023-12-11 12:44:19 +01:00
parent 49e96d53b3
commit e9f1aade15

View file

@ -150,4 +150,11 @@ public static class ActivityExtensions
/// Gets the root activity in the specified activity.
/// </summary>
public static string? GetWorkflowDefinitionId(this JsonObject activity) => activity.GetProperty<string?>("workflowDefinitionId");
/// <summary>
/// Determines whether the given activity is a workflow definition activity.
/// </summary>
/// <param name="activity">The JsonObject representing the activity.</param>
/// <returns>Returns true if the activity is a workflow definition activity; otherwise, false.</returns>
public static bool GetIsWorkflowDefinitionActivity(this JsonObject activity) => activity.ContainsKey("workflowDefinitionId") && activity.ContainsKey("workflowDefinitionVersionId");
}