public static async Task TriggerEntityChangedWorkflowsAsync(
            this IWorkflowDispatcher workflowDispatcher,
            string entityId,
            string entityName,
            EntityChangedAction changedAction,
            string?correlationId = default,
            string?contextId     = default,
            CancellationToken cancellationToken = default)
        {
            const string activityType = nameof(EntityChanged);
            var          input        = new EntityChangedContext(entityId, entityName, changedAction);

            var trigger = new EntityChangedBookmark(
                entityName,
                changedAction,
                contextId,
                null
                );

            var bookmark = new EntityChangedBookmark(
                entityName,
                changedAction,
                contextId,
                correlationId
                );

            await workflowDispatcher.DispatchAsync(new TriggerWorkflowsRequest(activityType, bookmark, trigger, input, correlationId, default, contextId, TenantId), cancellationToken);
Example #2
0
 public static async Task DispatchEntityChangedWorkflowsAsync(
     this IWorkflowLaunchpad workflowLaunchpad,
     string entityId,
     string entityName,
     EntityChangedAction changedAction,
     string?correlationId = default,
     string?contextId     = default,
     CancellationToken cancellationToken = default)
 {
     var input = new EntityChangedContext(entityId, entityName, changedAction);
     var query = QueryEntityChangedWorkflowsAsync(entityName, changedAction, correlationId, contextId);
     await workflowLaunchpad.CollectAndExecuteWorkflowsAsync(query, new WorkflowInput(input), cancellationToken);
 }