In the most painfully overdue blog post ever, considering my love of all things LightSwitch and Datazen, I finally sat down and consumed an oData feed I generated from a LightSwitch project I published to Microsoft Azure to use in a Datazen dashboard. It’s really pretty simple, and I’m kicking myself for not doing it before. Anyways, here’s how you do it –
1. If you don’t have the foggiest idea what Visual Studio LightSwitch is, you can read more about it here. It’s a fantastic tool for building rapid line-of-business applications for the desktop and mobile web apps. Plus, it’s available in the community edition of Visual Studio 2013, which is free for individual developers!
2. You need an app you are going to deploy and use the data feed from. Beth Massi has an excellent walkthrough (including a link to a sample app you can use) of how you can deploy a LightSwitch App to Azure. It’s very easy to do, and this is a great option to make your app available for Datazen to consume.
3. Once published, LightSwitch exposes the different data sources as easily consumable data feeds via oData, which happens to be one of the data sources that Datazen consumes out of the box with either anonymous or basic authentication. You could also create a custom data provider that used more advanced authentication options. To learn more about what oData is, you can read about that here.
So I published a simple app and put in some sample data to use with my Datazen Server –
Now, how do I setup Datazen server to use this feed as an oData source? Well, this confused me the first time I did it, so let’s go through it –
Login to your Datazen server as the admin, and choose the hub you wish to add this feed as a new data source for.
This is where you might get tripped up. Unlike every other data source listed, you don’t actually enter the data connection string at this point. You give your data source a name, choose the authentication method (and enter your credentials), hit next to setup permissions for the feeds, then hit finish.
If you try and put in the URL as the data connection name, it doesn’t save it, so it looks like the oData data source doesn’t actually work. Once you’ve saved the data connection details, you’ll see a new folder appear in you folder/data connections list –
Here, you can now enter the url in the OData view URL area that you wish to consume.
This gives you an easy way to visualize your data from your LOB app using your Datazen on your favorite mobile device. It also opens up a number of options around filtering your data prior to bringing it into Datazen using the entity set filter options with LightSwitch.
Thanks for reading!