public StatenodeWithExitActions WithExitActions <TContext>( OneOf <ActionDefinition, ActionDefinition <TContext> > action, params OneOf <ActionDefinition, ActionDefinition <TContext> >[] actions) { Definition.ExitActions = action.Append(actions) .Select(a => a.Match <OneOf <Model.ActionDefinition, ContextActionDefinition> >( contextlessAction => contextlessAction.ToDefinitionAction(), contextAction => contextAction.ToDefinitionAction())); return(this); }
internal ContextDataUnguardedWithActions( UnguardedContextDataTransitionDefinition transition, OneOf <ActionDefinition, ActionDefinition <TContext>, ActionDefinition <TContext, TEventData> > action, params OneOf <ActionDefinition, ActionDefinition <TContext>, ActionDefinition <TContext, TEventData> >[] actions) { Event = transition.Event; Targets = transition.Targets; Actions = action.Append(actions).Select(a => a.Match <OneOf <Model.ActionDefinition, ContextActionDefinition, ContextDataActionDefinition> >( contextlessAction => contextlessAction.ToDefinitionAction(), contextAction => contextAction.ToDefinitionAction(), contextDataAction => contextDataAction.ToDefinitionAction())); }
public static TaskService Chain( OneOf <TaskDelegate, TaskServiceDefinition> first, OneOf <TaskDelegate, TaskServiceDefinition> second, params OneOf <TaskDelegate, TaskServiceDefinition>[] remaining) => Define.Service.Task(async token => { foreach (var wrappedTask in first.Append(second).Append(remaining)) { var task = wrappedTask.Match(Functions.Identity, service => service.Task); await task(token); token.ThrowIfCancellationRequested(); } });
internal ContextGuardedWithActions( GuardedContextTransitionDefinition transition, OneOf <ActionDefinition, ActionDefinition <TContext> > action, params OneOf <ActionDefinition, ActionDefinition <TContext> >[] actions) : this(transition.Event, transition.Guard, transition.Targets, action.Append(actions)) { }