using Elsa.Activities.Entity; using Elsa.Activities.Console; using Elsa.Builders; using Elsa.Activities.Entity.Models; namespace Elsa.Samples.EntityChanged { /// /// This workflow gets invoked whenever an entity is added to the repository. /// It then blocks execution until the entity is deleted. /// public class EntityChangedWorkflow : IWorkflow { public void Build(IWorkflowBuilder builder) { builder .WithContextType() .EntityChanged(EntityChangedAction.Added) .WriteLine(context => $"Entity '{context.GetInput()!.EntityId}' was '{context.GetInput()!.Action}'") .EntityChanged(EntityChangedAction.Deleted) .WriteLine(context => $"Entity '{context.GetInput()!.EntityId}' was '{context.GetInput()!.Action}'"); } } }