@@ -8,7 +8,10 @@ Set-Alias -Name Wait-ActivityFunction -Value Wait-DurableTask
88
99function GetDurableClientFromModulePrivateData {
1010 $PrivateData = $PSCmdlet.MyInvocation.MyCommand.Module.PrivateData
11- if ($PrivateData ) {
11+ if ($PrivateData -eq $null -or $PrivateData [' DurableClient' ] -eq $null ) {
12+ throw " No binding of the type 'durableClient' was defined."
13+ }
14+ else {
1215 $PrivateData [' DurableClient' ]
1316 }
1417}
@@ -50,9 +53,6 @@ function Start-NewOrchestration {
5053
5154 if ($null -eq $DurableClient ) {
5255 $DurableClient = GetDurableClientFromModulePrivateData
53- if ($null -eq $DurableClient ) {
54- throw " Cannot start an orchestration function. No binding of the type 'durableClient' was defined."
55- }
5656 }
5757
5858 $InstanceId = (New-Guid ).Guid
@@ -98,9 +98,6 @@ function New-OrchestrationCheckStatusResponse {
9898
9999 if ($null -eq $DurableClient ) {
100100 $DurableClient = GetDurableClientFromModulePrivateData
101- if ($null -eq $DurableClient ) {
102- throw " Cannot create orchestration check status response. No binding of the type 'durableClient' was defined."
103- }
104101 }
105102
106103 [uri ]$requestUrl = $Request.Url
@@ -172,22 +169,15 @@ function Send-DurableExternalEvent {
172169 [object ] $EventData ,
173170
174171 [Parameter (
175- Position = 3 ,
176172 ValueFromPipelineByPropertyName = $true )]
177173 [string ] $TaskHubName ,
178174
179175 [Parameter (
180- Position = 4 ,
181176 ValueFromPipelineByPropertyName = $true )]
182177 [string ] $ConnectionName
183178 )
184-
185- CheckIfDurableFunctionsEnabled
186179
187180 $DurableClient = GetDurableClientFromModulePrivateData
188- if ($null -eq $DurableClient ) {
189- throw " Cannot send an external event to an orchestration function. No binding of the type 'durableClient' was defined."
190- }
191181
192182 $RequestUrl = GetRaiseEventUrl - DurableClient $DurableClient - InstanceId $InstanceId - EventName $EventName - TaskHubName $TaskHubName - ConnectionName $ConnectionName
193183
0 commit comments