Extensibility - aceryan-consulting/aceryansoft.codeflow GitHub Wiki
As allowed by the C# language, you can extend the framework and add your own codeflow containers.
public static class MyExtensions
{
public static ICodeFlowApi CustomExtension(this ICodeFlowApi codeFlowApi,Action<ICodeFlowContext, object[]> customAction)
{
codeFlowApi.Call((ctx, inputs) =>
{
// write awesome logic before
customAction(ctx,inputs);
// write awesome logic after
});
return codeFlowApi;
}
}
Now we can easily use CustomExtension container.
public class ExtensionCodeFlow
{
public void SampleCode()
{
var hello = new CodeFlow();
hello.StartNew()
.Call((ctx, inputs) =>
{
Console.WriteLine("Hello world");
})
.CustomExtension((ctx, inputs) => // add CustomExtension to the fluent api
{
Console.WriteLine("How are you today ?");
})
.Close();
hello.Execute();
}
}
Continue reading: Thank you