Skip to content

Instantly share code, notes, and snippets.

@wullemsb
Created April 25, 2026 12:26
Show Gist options
  • Select an option

  • Save wullemsb/910bd4640e54a0c448296b8f3672eeb6 to your computer and use it in GitHub Desktop.

Select an option

Save wullemsb/910bd4640e54a0c448296b8f3672eeb6 to your computer and use it in GitHub Desktop.
// Register the factory, not the workflow
services.AddSingleton<Func<MyWorkflow>>(sp =>
() => new MyWorkflow(sp.GetRequiredService<IMyDependency>()));
// At call site
var wf = workflowFactory(); // fresh each time
await env.RunAsync(wf, input, sessionId);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment