Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for default values #153

Merged
merged 2 commits into from
Sep 26, 2023
Merged

Conversation

boma96
Copy link
Collaborator

@boma96 boma96 commented Sep 26, 2023

Specifying default values which are embedded in workflow definition is now supported

public class DefaultValueWorkflowInput : WorkflowInput<DefaultValueWorkflowOutput>
{
    [DefaultValue("Default name")]
    public string Name { get; set; }

    [DefaultValue("Default address")]
    public string Address { get; set; }
}

public class DefaultValueWorkflowOutput : WorkflowOutput { }

public class DefaultValueWorkflow : Workflow<DefaultValueWorkflow, DefaultValueWorkflowInput, DefaultValueWorkflowOutput>
{
    public EmailPrepareV1 PrepareEmail { get; set; }

    public DefaultValueWorkflow(WorkflowDefinitionBuilder<DefaultValueWorkflow, DefaultValueWorkflowInput, DefaultValueWorkflowOutput> builder)
        : base(builder) { }

    public override void BuildDefinition()
    {
        _builder.AddTask(wf => wf.PrepareEmail, wf => new() { Name = wf.WorkflowInput.Name, Address = wf.WorkflowInput.Address });
    }
}

@boma96 boma96 merged commit 8a1c898 into master Sep 26, 2023
1 check passed
@boma96 boma96 deleted the feat/master/add-default-value branch September 26, 2023 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant