Bug in Generated Client OData Service

#1

I hit this problem months ago but was really busy and just put in a hack. Then I forgot about it and was bitten by this bug again. Figured I'd let you guys know about it this time.

I have an application with a SQL stored procedure that was exposed as an OData source on the server side. I then have a second (separate) app which is only a client, hooked up to the OData source from the first app. The code below is generated in the client app.

scheduling-odata.service.ts
spRegionsForProductsFunc(productContextId: string | null) {
return this.odata.get(/SpRegionsForProductsFunc(ProductContextID=${encodeURIComponent(productContextId)}), { });
}

Notice how the only parameter accepted by the odata function is a string. Also notice how the URL does not enclose the string value in quotes. This call results in a server-side error.

The following code works fine, with single quotes added. I've had to fix this manually.

return this.odata.get(`/SpRegionsForProductsFunc(ProductContextID='${encodeURIComponent(productContextId)}')`, {  });

Let's get this fixed before it bites me, or someone else again. Let me know if you need additional info.

0 Likes

#2

We will need the definition of the stored procedure. For some reason Radzen didn't infer the parameter type correctly (hence the missing quotes). You can send us the SQL script of the stored procedure to info@radzen.com

0 Likes