Created
August 13, 2023 08:08
-
-
Save mamidenn/9bb4d3c4d995fe8c1c4ce465437a7e65 to your computer and use it in GitHub Desktop.
Skipping Middleware for steps like `If`, `While`, etc. prevents unnecessary operations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Middleware : IWorkflowStepMiddleware | |
{ | |
public async Task<ExecutionResult> HandleAsync(IStepExecutionContext context, IStepBody body, WorkflowStepDelegate next) | |
{ | |
if (body is ContainerStepBody) return await next(); | |
Debug.WriteLine($"Start: {context.Step.Name ?? body.GetType().Name}"); | |
var result = await next(); | |
Debug.WriteLine($"End: {context.Step.Name ?? body.GetType().Name}"); | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment