1515 *
1616 */
1717
18+ using IdentityModel . Client ;
19+ using Newtonsoft . Json ;
1820using Simple . OData . Client ;
1921using Synapse . Integration . Events . WorkflowActivities ;
2022
@@ -80,7 +82,13 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
8082 {
8183 await base . InitializeAsync ( cancellationToken ) ;
8284 await this . HttpClient . ConfigureAuthorizationAsync ( this . ServiceProvider , this . Authentication , cancellationToken ) ;
83- var components = this . Function . Operation . Split ( "#" , StringSplitOptions . RemoveEmptyEntries ) ;
85+ var odataUriString = this . Function . Operation ;
86+ if ( odataUriString . IsRuntimeExpression ( ) )
87+ {
88+ var evaluationResult = ( string ? ) await this . Context . EvaluateAsync ( odataUriString , this . Activity . Input , cancellationToken ) ;
89+ if ( ! string . IsNullOrWhiteSpace ( evaluationResult ) ) odataUriString = evaluationResult ;
90+ }
91+ var components = odataUriString . Split ( "#" , StringSplitOptions . RemoveEmptyEntries ) ;
8492 if ( components . Length != 2 )
8593 throw new FormatException ( $ "The 'operation' property of the ODATA function with name '{ this . Function . Name } ' has an invalid value '{ this . Function . Operation } '. ODATA functions expect a value in the following format: <URI_to_odata_service>#<Entity_Set_Name>") ;
8694 this . ServiceUri = new ( components . First ( ) ) ;
@@ -97,7 +105,11 @@ protected override async Task ProcessAsync(CancellationToken cancellationToken)
97105 return ;
98106 try
99107 {
100- var commandOptions = this . FunctionReference . Arguments ? . ToObject < ODataCommandOptions > ( ) ;
108+ var parameters = this . FunctionReference . Arguments ? . ToObject ( ) ! ;
109+ var inputData = this . Activity . Input ! . ToObject ( ) ! ;
110+ parameters = ( await this . Context . EvaluateObjectAsync ( parameters , inputData , cancellationToken ) ) ! ;
111+
112+ var commandOptions = JsonConvert . DeserializeObject < ODataCommandOptions > ( JsonConvert . SerializeObject ( parameters ) ) ;
101113 var command = this . EntitySet ;
102114 if ( ! string . IsNullOrWhiteSpace ( commandOptions ? . Key ) )
103115 command += $ "({ commandOptions . Key } )";
0 commit comments