Top 7 Features of Visual Studio LightSwitch

by V.N.S Arun

Learn more about Microsoft Visual Studio LightSwitch as we count down the 7 best features in this new Microsoft offering.


Microsoft introduced LightSwitch applications very recently. It is integrated with Microsoft Visual Studio which can be a standalone on Visual Studio 2010 or could accommodate itself as a part of the normal Microsoft Visual Studio 2010 IDE. The LightSwitch applications are introduced for creating a line of business applications which are more data-centric.

Most data-centric business applications perform the same basic CRUD (Create, Read, Update and Delete) operations. In such applications what the developer would do again and again is writing the same kind of code and developing a similar kind of UI.

Microsoft Visual Studio LightSwitch revolves around selecting the type of screen and defining the data for the screen. Below are the list of ready made screen types that Lightswitch provides.

  1. New Data Screen
  2. Search Data Screen
  3. Details Screen
  4. Editable Grid Screen
  5. List and Details Screen

The Lightswitch application eases the job of the developer by asking him to define a data source with a well defined schema and simply add the appropriate screen for it. Maybe a little customization and business logic should be written if required.

Microsoft Visual Studio LightSwitch can be downloaded from here. Note that only the Beta version of Visual Studio Lightswitch is released.

Fast Paced Development of Data-centric Applications

When using LightSwitch the development time is reduced as the developer doesn't have to spend much time on the UI and data access since the data screens are readily available and it can do the data access on its own. If any customization is required only then does the developer needs to intervene. This ensures a couple of things:

  1. The data-centric business applications are developed fast and in a stable manner.
  2. The final product gets into the user's hand in no time.

For example here are the steps for creating a sample working screen.

  1. Create the table to store data and define the schema for it.
  2. Select Add New Screen and select the required screen as shown in Fig 1.0
  3. Select Add New Screen and select the required screen
    Fig 1.0

  4. Run the application, you are done with add new or search module based on the screen you have selected.

By considering the above information you can understand how fast a data-centric application can be developed using LightSwitch.

Easy to Choose Whether the Application is to be Browser Based or Desktop Application

This is really an astonishing fact. Declaration of your application to run on a desktop environment or on a web browser is just a click away. Believe me this declaration shouldn't need to be done before starting off with the project but can be done during the course of development or even if the development is complete. All you need to do is go to the properties of the project and choose the application type that's it you are done. Check Fig 2.0

 choose the application type
Fig 2.0

Fig 2.1 shows the sample application selected to run as a desktop client

sample application selected to run as a desktop client
Fig 2.1

Fig 2.2 shows the sample application opted to be run in a web browser

sample application opted to be run in a web browser
Fig 2.2

Support for Multiple Data Sources

Apart from the basic data source such as a normal database you could use the following data sources in the LightSwitch applications that you develop.

  1. Sharepoint
  2. WCF RIA services
  3. External Databases
  4. SQL Azure

Fig 3.0 shows the screen shot for adding Other Datasources.

Fig 3.0

Data Integrity and Validation is Straightforward

While you create the data table you would notice that there are business domain data types like EmailAddress, Money and PhoneNumber. These business domain data types increase the data integrity in the application as these fields would expect only data in specific formats like <emailid>@<domain>.com.

Another wonderful thing about the Lightswitch application is the data validation. The validation is performed on the screen based on the type of the underlying data and appropriate message is displayed as shown in Fig 4.0.

Fig 4.0

It doesn't stop there, in case the developer likes to provide a custom validation for a particular type then he can click the CustomValidation link available on the property window of that column. Fig 4.1 shows the screen shot of it.

Fig 4.1

Application Customization - On the Fly

Like the classic .NET applications in order to customize the UI the developer doesn't have to stop the application from running. There is an option available on the output screen saying "Customize Screen" as shown in Fig 5.0, simply click on it and do the required customization on the screen.

Fig 5.0

Note: This option will only be available when the application is run in debug mode. So when the application is given to the user in release mode this option will not show up.

Built On Top of .NET Framework

The best part of all is the entire Lightswitch application is built on top of .NET framework. As the name indicates the UI of the application is generated using Silverlight and the data retrieval is achieved using WCF RIA services. This gives developers the provision to perform custom implementations in C# Programming or Visual Basic using the .NET framework as required by the business.

Application Security - Authentication

Visual Studio Lightswitch application supports the below mentioned authentication modes.

  1. Forms
  2. Windows
  3. None

Go to the project properties and select Access Control. You will find the options to select the type of authentication required as shown in Fig 6.0.

Fig 6.0

The developer would be able to add the users if the "Granted for debug" option is selected as shown in Fig 6.0. Fig 6.1 shows the sample built-in add user screen.

Fig 6.1


I hope this article provided a good overview of Microsoft Visual Studio LightSwitch, its capability and the top 7 features. Most developers should be able to develop a decent data-centric application using LightSwitch pretty quickly. If you have any conflicts or comments then please make use of the comments section.

Happy reading!

Related Articles

This article was originally published on Friday Oct 22nd 2010
Mobile Site | Full Site