Visual Studio LightSwitch: A Useful Rapid Development Tool for Building Data Applications

What Visual Studio LightSwitch is good for: quickly building data-centric apps

Don Kiely

April 5, 2011

6 Min Read
ITPro Today logo in a gray background | ITPro Today

Microsoft recently released Beta 2 of its upcoming Visual Studio LightSwitch development tool, and I've been working with it a lot for an upcoming project. I wasn't sure that the world needed another Microsoft development environment, but the more I've worked with LightSwitch the more I've grown to appreciate its value for a certain class of applications.

LightSwitch is a Visual Studio-based development environment and application framework for quickly building data-centric applications. It provides a rich three-tier application infrastructure that lets the developer focus on the custom business logic and data design, minimizing the amount of code required. The idea is that you can quickly design, build, test, and deploy applications for small business or departmental units, getting them into the hands of users that need them today. The developer is freed from designing an application architecture and selecting the right technologies, because for the most part LightSwitch has made all those decisions for you. If you can live with the choices and need the application done fast, LightSwitch can be a surprisingly viable option.

A LightSwitch application is built using Silverlight 4.0, Windows Communication Foundation (WCF) RIA Services, Entity Framework, and other proven .NET-based technologies, accessing data stored in SQL Server, SQL Server Express, Azure, or SharePoint. It uses well-known and widely used patterns and best practices like a three-tier application architecture and MVVM (Model View ViewModel). Microsoft seems to have been careful not to invent any new development technologies for LightSwitch, instead preferring to go with the tried and the true. For the most part, LightSwitch restricts your direct access to its underlying technologies, so you can't muck around with them even if you want to. But it does provide some APIs to the underlying data objects and has extensive support for extensibility at almost every level when you want to go beyond LightSwitch's out-of-the-box capabilities.

Because LightSwitch is built on Silverlight, you can easily deploy the final application either to the desktop or to a web server to run in a browser. The application loses a bit of functionality when run in the browser, since it runs in the Silverlight sandbox and can't access things like COM automation or get unlimited access to the local file system. But if you can live with those limitations, there is currently no easier or quicker way to quickly build a browser-based Silverlight application.

Using LightSwitch
You can install LightSwitch either as a standalone dedicated Visual Studio instance or, if you install it on top of an existing Visual Studio installation, an additional set of Visual Studio project templates. When you create a new LightSwitch project, you start by selecting whether you want to use Visual Basic or C#, then specify whether you want to access an existing data store or create a new one. If you use an existing SQL Server database, for example, LightSwitch will import the schema for the tables and views you select and create entity objects you can access in the application to handle all data access. If you select to create a new data store, it will create a design-time SQL Server Express database of your design, along with data entities over them, and deploy the resulting schema with the application. Then you can begin creating screens using various templates that let the user interact with the data. You don't even have to customize the screens from the defaults, and the result will be a serviceable if not entirely satisfying user experience.

From there, you have extensive options to customize the application. You'll almost certainly want to customize the screens, add validation at the entity or screen level, and add the touches that make for an easy-to-use, robust, data-centric application. The important point is that the basic application is all there and running, and all you have to do is the customizations necessary to implement logic and features most important to your users.



I'm usually leery of any time Microsoft says anything about doing development "without code!" Over the years, that has usually meant that there is a cool feature that makes for a great demonstration at a conference keynote, but that you have to write more code than you would have had you started from scratch to make the feature do anything useful. Although I can't imagine creating a LightSwitch application with no code at all, I can spend my time writing just the code required to implement custom logic. That's quite an accomplishment, as much a testimony to the LightSwitch team's hard work as to the maturity of the development technologies that LightSwitch is built with. Not everyone (not even close!) will agree with the decisions they made, but I think many developers (of both the professional and more casual types) will find LightSwitch useful for some applications.

What's Missing in LightSwitch
LightSwitch will soon be a version 1.0 product, and as such is a work in progress. Most notably missing is any support for printing or generating data reports. I suspect that support is coming, but in the meantime you'll have to rely either on tools like SQL Server Reporting Services or other third-party solutions. The built in Export to Excel feature available by default from any screen that displays data collections is useful as far as it goes, but it just isn't robust enough for data reporting. I don't think Microsoft needs to build a reporting system just for LightSwitch, but it would certainly be helpful if the tool included at least minimal printing and reporting capabilities at some point. There are a few other omissions, but printing is probably the one that users will miss the most. And Microsoft seems to be counting on third parties to fill in some of the other gaps in the product.

A Rapid Application Development Tool
LightSwitch is most certainly not a general-purpose development environment, nor is it intended to be. It is appropriate for a relatively narrow class of applications, but that type of application is probably by far the most common custom application used in business today. You give up technology and architecture options when you use LightSwitch, but the benefit is truly rapid application development. At the very least, it deserves a hard look anytime you start work on an application whose reason for being is to provide a user interface to data. If the goal is to get a usable application into user's hands quickly, rather than creating the Next Big Thing, LightSwitch just might become the tool of choice. Only time will tell!

Don Kiely ([email protected]), MVP, MCSD, is a senior technology consultant, building custom applications and providing business and technology consulting services. His development work involves SQL Server, Visual Basic, C#, ASP.NET, and Microsoft Office.

Read more about:

Microsoft
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like