Skip navigation

Product Review: Visual Studio LightSwitch

Microsoft Visual Studio LightSwitch is a new tool for building distributed business applications. The fact that the product includes "Visual Studio" in its name tells you that it uses the same development environment as other Microsoft .NET development tools. However, LightSwitch takes a very different approach to application development.

In a traditional application development project, you typically start by creating an initial screen, after which you tie a data source to the screen. In LightSwitch, you start by defining your data source, after which you create a screen against that data source. LightSwitch is about enabling access to data. The source of that data can be a SQL Server database, SharePoint list, or Windows Communication Foundation (WCF) Rich Internet Application (RIA) Services.

As the Solution Explorer pane in Figure 1 shows, the LightSwitch project structure differs from the traditional application project structure in that you have two default folders. The Data Sources folder stores connection information, XML Schema Definitions (XSDs), and other information related to the data sources. As you generate screens, they'll be stored in the Screens folder.

 Figure 1: LightSwitch project structure
Figure 1: LightSwitch project structure

Clicking the Attach to external Data Source option in the screen in Figure 1 launches a wizard that walks you through configuring a data source. For this review, I used an existing SQL Server database as a data source. There are two limitations in doing so. First, LightSwitch doesn't support stored procedures. Second, if an existing table doesn't have a primary key, the table's data will be read-only, as Figure 2 shows. So, if you're new to LightSwitch, I suggest that you start by creating a new database. That way, LightSwitch will automatically provide an integer primary key for each new table, which you can use as a foreign key between tables.

Figure 2: Warning message about the consequences of not having a primary key
Figure 2: Warning message about the consequences of not having a primary key 

Creating the screens that will be used to access the data is straightforward because the screens are based on templates. Typically, you use the LightSwitch templates, but you can create new templates or import third-party templates. Because you're using templates, you can leverage the highly scalable tools upon which LightSwitch is built -- the ADO.NET Entity Framework, Extensible Application Markup Language (XAML)-based Silverlight, and WCF RIA Services -- without needing to understand their details.

Aside from changing the order of data fields, there are limited options for template customization out of the box. However, one of the main reasons LightSwitch is classified as a developer tool is its extensibility. To customize the layouts, you can work with a developer who is familiar with XAML. The developer can leverage the LightSwitch SDK to create custom UI elements. The SDK is available as a free download.

Besides being able to customize the templates and their layout, developers can create custom data sources and custom data types. The latter is important when you use a SQL Server database as a data source. Instead of adding base SQL Server data types to work with databases, LightSwitch adds a few custom data types (e.g., data types for phone numbers and email addresses) that are implemented in the data layer above SQL Server. Using the SDK, it's possible to create additional custom data types.

The ease with which templates are generated and later customized makes LightSwitch an excellent prototyping tool. You can define a set of data tables integrated with services and generate a basic UI that lets you test data-entry assumptions. You can use this prototype for a quick win, then introduce more customizations to meet additional business needs on subsequent generations of the application.

You can deploy LightSwitch applications on the desktop, on the web, or in Windows Azure. However, when deploying LightSwitch applications internally, keep in mind that users' desktops or the web server will need to have the LightSwitch runtime DLL installed. LightSwitch doesn't just generate compiled code. It uses metadata to define the UI, and it's the runtime DLL that understands how to emit the correct code to power the interface.

By default, LightSwitch uses the Active Directory (AD) infrastructure to provide base security. It's also possible to create custom rules within LightSwitch related to the application. These rules live within the application configuration and get deployed with the application.

Although LightSwitch is a new development tool, there's already a lot of documentation for it. MSDN's LightSwitch Developer Center ( includes documentation, videos, samples, and blogs. In particular, Beth Massi's blogs ( provide detailed step-by-step examples of how to build powerful business applications that look great using LightSwitch. You can also use the Visual Studio Extension Manager to download existing custom themes, data types, and related tools.

Despite the abundance of documentation, developers might approach LightSwitch with trepidation for two reasons:

  • They might feel that their skills are being underutilized. In its current version, LightSwitch probably isn't the tool developers will want to use to create a new dynamic UI. However, it provides a simple yet powerful development environment for creating departmental applications.
  • They might think of LightSwitch as a "Fisher-Price" development tool that will create hard-to-transition applications -- that is, once you build an application with it, transitioning that application to .NET would be difficult or require a complete rewrite. However, LightSwitch isn't a language or a closed development paradigm. It leverages technology sets (e.g., ADO.NET Entity Framework, XAML-based Silverlight) that are available to and used by professional developers. LightSwitch applications are customizable using C# or Visual Basic. They're also fully extensible both under the covers and with external UIs and controls. Although LightSwitch applications might not be ready to become the next, they do help businesses meet the need of creating effective applications on a limited budget.

If you're a DBA who needs a simple way to build effective UIs for your corporate data, you might want to check out some completed screens from the sample LightSwitch application at If you're a developer who has some reservations about LightSwitch, be sure to read about the developer's experiences when building this application.

Visual Studio LightSwitch
PROS: Allows people who aren't black belts in .NET to build secure and effective UIs for business applications; easy to extend; leverages scalable best practices without requiring in-depth implementation knowledge
CONS: Requires time to master in order to truly customize a UI; a custom server component must be installed on the server to host applications; lack of stored procedure support
RATING: 4 out of 5
PRICE: $299
RECOMMENDATION: Visual Studio LightSwitch is a great tool if you need a way to create basic UIs.
CONTACT: Microsoft • 877-696-7786 •

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.