Quickly Build Data-centric Business Applications with Visual Studio LightSwitch

Welcome to the Visual Studio LightSwitch Team Blog! This is where LightSwitch team members will be posting information about a new product we’re building here at Microsoft geared for business application developers.

My name is Jay Schmelzer and I’m the Group Program Manager for the Visual Studio BizApps team at Microsoft which includes the LightSwitch product team. We’ve been working hard for a while on this new exciting product and I’m happy that we can now talk about it with the world. Jason Zander and Soma announced it on their blogs and Jason demoed it at the VSLive keynote Tuesday morning which you can watch by visiting the LightSwitch Developer Center.  I also did a session with the Channel 9 folks where we took a tour around the product and talked in more depth about the technologies involved in a LightSwitch application.

LightSwitch is a new development tool for building business applications that simplifies the development process because it lets you concentrate on the business logic and does a lot of the remaining work for you. With LightSwitch, an application can be designed, built, tested, and in your user’s hands quickly. LightSwitch applications can be deployed as desktop application, giving them the ability to integraete with hardware devices such as a scanner or bar code reader, as well as other applications like Microsoft Word and Excel or as browser based applications when broader reach is required. Because LightSwitch applications are based on Silverlight and a solid .NET n-tier application framework, you can create both browser and desktop applications that look and act the same. In most cases, you can even switch from a browser application to a desktop application and back again by changing a single setting and redeploying.

Users expect certain features like search, the ability to sort and rearrange grids, and the ability to export data. With every LightSwitch application those features are already built in — you don’t have to write any code for navigation, toolbars/ribbons, or dirty checking. Common data operations such as adding, updating, saving, and deleting are also built in, as well as basic data validation logic. You just set some validation properties or write some simple validation code based on your business rules and you’re good to go. You can also use custom business types which help reduce the code that you write. For example, the EmailAddress and Phone data types are built in. This eliminates the requirement to apply formatting in the user interface.

Creating a LightSwitch Application

The process of creating a LightSwitch application should be familiar to you if you are using other development tools. You connect to data, create a form and bind the data to the controls, add some validation based on business logic, and then test and deploy – just like you would expect. The difference with LightSwitch is that each one of those steps is simplified.

For example, tables, or data entities in LightSwitch, can be created in the built in application database, or can be brought in from an external database, SharePoint list, or other data sources. You can create relationships between entities, even between entities from different data sources. (Click pictures to enlarge)


Queries over the data can be created in a graphical designer and can be extended in code as needed.


Forms, or screens in LightSwitch, are based on an extensible set of predefined templates that provide good starting points which can be customized later. In addition to the screen templates that LightSwitch offers out-of-the-box, you can download more templates provided by the community and control vendors directly from LightSwitch via the Visual Studio Gallery. Data binding is as simple as specifying which entities or queries will be displayed as the screen data.


There are numerous places to add custom business logic code. You can handle simple validation such as required fields and string lengths in the designer, or you can write code to handle more complex validation, business rule or defaulting logic. In the running application, the validation logic is then automatically built into the screens and validation errors are displayed to the end user for you. Inserting custom actions in the data save pipeline and authorization checkpoints are other examples of where you can write custom business logic code.


To create a fully working application from scratch, all you need to do is create your entities, decide on how you want to query and display the data and hit F5. LightSwitch will create a full-blown application shell for you with a screen navigation pane, a ribbon across the top with default commands and a tabbed area displaying the open screens. The application also has built in “dirty checking” right off the bat – meaning if you edit data on a screen and navigate away from it or try to close it, the application will prompt you. All this comes for free without having to write the code yourself.


In addition to built-in features, LightSwitch applications follow N-tier architecture patterns, and incorporate best practices by default like data paging, async data loading, and well-known UI patterns to produce usable, scalable, and robust applications. You can also quickly change the look and feel of the UI as you develop the application while the application is running. This is particularly helpful since you can see real data loaded in the app as you make UI tweaks.


When you are ready to deploy your LightSwitch application you can choose from a 2-tier application or as a 3-tier application, with a middle-tier running in IIS, configuration, point us to your production (or staging) database and LightSwitch will create the SQL scripts necessary to deploy your database and an msdeploy package to install the middle-tier.

Stay tuned for more detailed walkthroughs, tutorials, tips & tricks and under the covers looks at how LightSwitch applications are constructed from members of the team. On August 23rd we will be releasing our Beta 1, so stay tuned for that download and keep an eye on the LightSwitch Developer Center where we will be rolling out more content weekly.