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);
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); }
private static WorkflowsQuery QueryEntityChangedWorkflowsAsync( string entityName, EntityChangedAction changedAction, string?correlationId = default, string?contextId = default) { const string activityType = nameof(EntityChanged); var bookmark = new EntityChangedBookmark( entityName, changedAction ); return(new WorkflowsQuery(activityType, bookmark, correlationId, ContextId: contextId)); }
public static ISetupActivity <EntityChanged> WithAction(this ISetupActivity <EntityChanged> activity, EntityChangedAction action) => activity.Set(x => x.Action, action);
public EntityChangedToken(object entity, EntityChangedAction action) { Entity = entity; Action = action; }
public static IActivityBuilder EntityChanged <TEntity>(this IBuilder builder, EntityChangedAction action, [CallerLineNumber] int lineNumber = default, [CallerFilePath] string?sourceFile = default) => builder.EntityChanged(setup => setup.WithEntity(typeof(TEntity)).WithAction(action), lineNumber, sourceFile);
public EntityChangedContext(string entityId, string entityName, EntityChangedAction action) { EntityId = entityId; EntityName = entityName; Action = action; }