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

Input / Output #245

Merged
merged 3 commits into from
Jan 19, 2019
Merged

Input / Output #245

merged 3 commits into from
Jan 19, 2019

Conversation

danielgerlag
Copy link
Owner

@danielgerlag danielgerlag commented Jan 18, 2019

@dr-BEat @Kahbazi @ssougnez @w-bonelli

Action Inputs / Outputs

Added the action Input & Output overloads on the fluent step builder.

Input(Action<TStepBody, TData> action);

This will allow one to manipulate properties on the step before it executes and properties on the data object after it executes, for example

Input((step, data) => step.Value1 = data.Value1)
.Output((step, data) => data["Value3"] = step.Output)
.Output((step, data) => data.MyCollection.Add(step.Output))

Breaking changes

The existing ability to assign values to entries in dictionaries or dynamic objects on .Output was problematic, since it broke the ability to pass collections on the Output mappings.

.Output(data => data["Value3"], step => step.Output)

This feature has been removed, and it is advised to use the action Output API instead, for example

.Output((step, data) => data["Value3"] = step.Output)

This functionality remains intact for JSON defined workflows.

@dr-BEat
Copy link
Contributor

dr-BEat commented Jan 18, 2019

This is quite nice! We can now avoid all the reflection for workflows that are defined in code, maybe it brings even some performance improvements for fast running workflowsteps.

I wanted to do something very similar when I looked at the problem first, but did not want to introduce breaking changes to the Api.

danielgerlag and others added 2 commits January 19, 2019 07:52
Co-Authored-By: danielgerlag <daniel@gerlag.ca>
@danielgerlag danielgerlag merged commit d46399a into master Jan 19, 2019
@ssougnez
Copy link

Another question... How does it play with the json format of the workflow ? Indeed you could potentially use whatever C# code so can you just put this C# code in the JSON or are there some limitations ?

@danielgerlag
Copy link
Owner Author

Actually, the expressions in JSON are not C#... they are parsed with this expression library.

https://github.com/StefH/System.Linq.Dynamic.Core/wiki/Dynamic-Expressions#expression-language

However, the action based inputs/outputs are not yet available via JSON, I'm still trying to decide the best way to represent this in JSON

@ssougnez
Copy link

I really like the work you did in the documentation of WFC. The samples with the README are really handy and provide information in a quick way. However, the JSON part of WFC is pretty undocumented. Indeed, apart from the small part in the main README file, there is nothing. It would be interesting to provide, in each README file where you showed a specific feature of WFC, the JSON representation of the code used in the sample (or at least some kind of pointer to the format to use for the specific feature).

Keep up the good work ;-)

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.

4 participants