LightSwitch in Visual Studio 2012 Proves Effective as RAD Tool

By Jeff Cogswell  |  Posted 2013-02-12 Print this article Print

Each field also gets various other properties accessible through the Properties window, including Display Name, which specifies how it shows up by default in the screens. (Remember, this is a tool for high-level database app development, so there are a lot of things that happen automatically for you.)

You can set up multiple tables and create relationships between them. This was a little strange, because normally when you create database apps and create relationships, you create the fields in the table that become foreign keys in other tables. That’s not how it works here, though. Instead, you don’t create a foreign key field. You simply create a relationship between the two tables and LightSwitch automatically creates the foreign key field for you.

I suspect the reason is that it’s more of a high-level concept than purely technical. Whereas a technical person might see tables in terms of outer joins and what-not, a non-technical person might see it as “drilling down” or “sub data.” For example, you might have a table with customers, and inside that you might drill down to see any one customer’s orders.

The orders might feel conceptually as sub-tables. And that’s more or less how the data is presented here. And while modeling data, you choose the name used for each field when it’s displayed, and whether it’s displayed at all. Yes, you’re mixing data and presentation, but again, this isn’t a tool for developing highly sophisticated, custom software.

As for attaching to external data sources, LightSwitch includes a data provider for Microsoft’s OData protocol as well as for SQL Server and most other .NET data providers you have already installed on your computer. (For example, I had installed MySQL Connector/Net, so MySQL is available to me.)

The OData protocol was invented by Microsoft and is based on the Representational State Transfer (REST) and the JavaScript Object Notation (JSON) protocols for connecting to remote data sources. It works pretty well. I was able to connect to a free, read-only version of the Northwind Database that Microsoft has made available.

All I had to do was provide the URL to make the connection. Other companies have embraced the protocol, as well. For example, Netflix has its entire catalog accessible online through the protocol. I tried that one too and was able immediately to model the entire catalog of movies. (LightSwitch did reject a couple of the data types in the catalog, however, and skipped those fields.)

Creating Screens

After you’ve modeled your data, you create application screens. This is where things have partly improved over the Silverlight approach, but also aren’t as good. When you create your screens, they will ultimately get rendered in the browser. That worked out pretty well. But I found the controls were severely lacking compared with the Silverlight version.

Building the screens is pretty easy. I wanted to try out the Netflix library. In the Solution Explorer there’s an add screen menu item, which opens the Add New Screen dialog. Here you can create three different types of screens (but you have even more control later). You can choose between Browse Data Screen, View Details Screen and Add/Edit Details Screen.


Submit a Comment

Loading Comments...
Manage your Newsletters: Login   Register My Newsletters

Rocket Fuel