jaydata icon indicating copy to clipboard operation
jaydata copied to clipboard

Collection(Edm.String) support for OData FunctionImport

Open heshan-nibaya opened this issue 9 years ago • 0 comments

I get this error when trying to pass the string array into a oData function. (This is almost similar to issue #91)

(About the project: WebAPI OData v3, Jaydata v1.3.6)

Exception: Unable to resolve type:Collection(Edm.String)
 Exception {name: "Exception", message: "Unable to resolve type:Collection(Edm.String)"

Metadata fragment

<FunctionImport Name="GetMultipleRecentLocation" ReturnType="Collection(GPSLocationDataDto)" IsBindable="true" EntitySet="GPSLocationData" m:IsAlwaysBindable="true">
<Parameter Name="bindingParameter" Type="Collection(GPSLocationDataDto)" Nullable="false"/>
<Parameter Name="DeviceIDS" Type="Collection(Edm.String)" Nullable="false" FixedLength="false" Unicode="false"/>
<Parameter Name="OnlyLocated" Type="Edm.Boolean" Nullable="false"/>
</FunctionImport>

Resulting JavaScript fragment (via JaySvcUtil)

'GPSLocationData': { type: $data.EntitySet, elementType: GPSLocationDataDto, actions: { 
        'GetMultipleRecentLocation': { type: $data.ServiceAction, returnType: $data.Queryable, elementType: 'GPSLocationDataDto', IsBindable: true, 'EntitySet': 'GPSLocationData', IsAlwaysBindable: true, params: [{ name: 'DeviceIDS', type: 'Collection(Edm.String)' }, { name: 'OnlyLocated', type: 'Edm.Boolean' }] }
      }}

For now I've managed to workaround this issue by changing,

Collection(Edm.String) to Array in the JavaScript fragment

Hope this is useful. Thanks

heshan-nibaya avatar Apr 02 '15 11:04 heshan-nibaya