Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/DurableSDK/PowerShellServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ namespace Microsoft.Azure.Functions.PowerShellWorker.Durable
{
using System;
using System.Management.Automation;
using Microsoft.Azure.Functions.PowerShellWorker.Utility;

internal class PowerShellServices : IPowerShellServices
{
private const string SetFunctionInvocationContextCommand =
"Microsoft.Azure.Functions.PowerShellWorker\\Set-FunctionInvocationContext";
private const string SetFunctionInvocationContextExternalCommand =
"DurableSDK\\Set-FunctionInvocationContextExternal";

private readonly PowerShell _pwsh;
private bool _hasSetOrchestrationContext = false;
Expand All @@ -28,7 +31,9 @@ public PowerShell GetPowerShell()

public void SetDurableClient(object durableClient)
{
_pwsh.AddCommand(SetFunctionInvocationContextCommand)
_pwsh.AddCommand(Utils.ImportModuleCmdletInfo)
.AddParameter("Name", "DurableSDK");
_pwsh.AddCommand(SetFunctionInvocationContextExternalCommand)
.AddParameter("DurableClient", durableClient)
.InvokeAndClearCommands();

Expand All @@ -38,7 +43,7 @@ public void SetDurableClient(object durableClient)

public void SetOrchestrationContext(OrchestrationContext orchestrationContext)
{
_pwsh.AddCommand(SetFunctionInvocationContextCommand)
_pwsh.AddCommand(SetFunctionInvocationContextExternalCommand)
.AddParameter("OrchestrationContext", orchestrationContext)
.InvokeAndClearCommands();

Expand All @@ -49,7 +54,7 @@ public void ClearOrchestrationContext()
{
if (_hasSetOrchestrationContext)
{
_pwsh.AddCommand(SetFunctionInvocationContextCommand)
_pwsh.AddCommand(SetFunctionInvocationContextExternalCommand)
.AddParameter("Clear", true)
.InvokeAndClearCommands();
}
Expand Down