@@ -7,11 +7,14 @@ namespace Microsoft.Azure.Functions.PowerShellWorker.Durable
77{
88 using System ;
99 using System . Management . Automation ;
10+ using Microsoft . Azure . Functions . PowerShellWorker . Utility ;
1011
1112 internal class PowerShellServices : IPowerShellServices
1213 {
1314 private const string SetFunctionInvocationContextCommand =
1415 "Microsoft.Azure.Functions.PowerShellWorker\\ Set-FunctionInvocationContext" ;
16+ private const string SetFunctionInvocationContextExternalCommand =
17+ "DurableSDK\\ Set-FunctionInvocationContextExternal" ;
1518
1619 private readonly PowerShell _pwsh ;
1720 private bool _hasSetOrchestrationContext = false ;
@@ -36,7 +39,9 @@ public bool UsesExternalDurableSDK()
3639
3740 public void SetDurableClient ( object durableClient )
3841 {
39- _pwsh . AddCommand ( SetFunctionInvocationContextCommand )
42+ _pwsh . AddCommand ( Utils . ImportModuleCmdletInfo )
43+ . AddParameter ( "Name" , "DurableSDK" ) ;
44+ _pwsh . AddCommand ( SetFunctionInvocationContextExternalCommand )
4045 . AddParameter ( "DurableClient" , durableClient )
4146 . InvokeAndClearCommands ( ) ;
4247
@@ -46,7 +51,7 @@ public void SetDurableClient(object durableClient)
4651
4752 public void SetOrchestrationContext ( OrchestrationContext orchestrationContext )
4853 {
49- _pwsh . AddCommand ( SetFunctionInvocationContextCommand )
54+ _pwsh . AddCommand ( SetFunctionInvocationContextExternalCommand )
5055 . AddParameter ( "OrchestrationContext" , orchestrationContext )
5156 . InvokeAndClearCommands ( ) ;
5257
@@ -62,7 +67,7 @@ public void ClearOrchestrationContext()
6267 {
6368 if ( _hasSetOrchestrationContext )
6469 {
65- _pwsh . AddCommand ( SetFunctionInvocationContextCommand )
70+ _pwsh . AddCommand ( SetFunctionInvocationContextExternalCommand )
6671 . AddParameter ( "Clear" , true )
6772 . InvokeAndClearCommands ( ) ;
6873 }
0 commit comments