Search code examples
odatavisual-studio-lightswitchlightswitch-2013

How to define Actions in LightSwitch ODATA and use them from LightSwitch HTML client


my first question on StackOverflow, so apologies if not perfect right from the beginning ...

My question is actually two-fold:

  1. Can I have the LightSwitch ApplicationData service (or any other internally defined Data Source) define ODATA actions on the service level or entity set/entity level? If yes, how do I do that? (I cannot find the route information in the application where I could override/add that.)

  2. How would I consume these actions from the client side (via the built-in MS JS object model in msls or via screen/entity)? Even, if LightSwitch itself could not create/would not support actions, I would still like to know how to consume them from the client side, as we are exposing external ODATA data sources via LightSwitch to the client (and these ODATA source have actions defined). I know I can use jaydata from the client side to consume that and execute actions on an ODATA source, but I would like to know if LightSwitch has built-in support for that.

Further information: we are using VS/LS 2013. And Silverlight is not an option, we only use the HTML client.

Thank you very much for your support and hints! Regards, Ronald


Solution

  • There is nothing built-in to LightSwitch that lets you define custom OData actions on the service side or consume them from the client side. You'd need to use standard web functionality like ASP.NET's WebAPI and your favorite JavaScript OData library, like JayData.