Featured Database Articles

SQL Server Meets Microsoft Visual Studio LightSwitch

No programming skills? No problem. Microsoft Visual Studio LightSwitch is all about building data-centric applications and all of the plumbing necessary to make the database connections is done for you behind the scenes. Read along as we look at what this tool can do for you.

Introduction

Developing a tool for building applications with little to no programming skills has been the goal of multiple companies over the last twenty some odd years. You would think that after all this time someone would have come up with a way to automatically generate computer programs to do just about anything. While there are some products on the market that come close, there really isn't a tool that completely writes a program for you.

Microsoft Visual Studio LightSwitch takes another shot at the no-programming-experience-needed goal with the target of building applications to run both natively and over the web. It's the culmination of several years' worth of research and development effort on the part of Microsoft aimed specifically at the relatively simple line-of-business application market. The target user of the product is someone with little-to-no programming experience but a good understanding of the business process needing to be automated.

Database Centric

LightSwitch at the core is all about building data-centric applications. When you first fire up the program and create a new project you'll be asked to either create a new data table or connect to an external data source. All the plumbing necessary to make the database connections is done for you behind the scenes. To connect to password protected data sources will require a one-time username and password and, after that, it will be automatic.

One of the new things that LightSwitch brings to the table is the idea of real-world data types like phone numbers and email addresses. In a typical business language like Visual Basic this would typically require some additional logic to take a string input field, validate that the input data looked something like a phone number (no letters, right number of digits, etc) and then save the result to a string field. Fields can also have default values or partial values such as a default domain for an e-mail address. When you create a table from scratch, LightSwitch actually fires up a copy of Microsoft SQL Express with a file-attached data source.

Figure 1

To talk to external SQL databases LightSwitch uses EDM. This provides direct access to all the popular SQL database engines including Microsoft SQL Server, Oracle and more. LightSwitch also uses the recently released Windows Communication Foundation (WCF) Rich Internet Application (RIA) services to communicate between the application and any external data source, including Cloud SQL Azure.

Out-of-the-box (OOTB) support for SharePoint as an external data source makes LightSwitch a great candidate for apps to manipulate any SharePoint table. The development environment provides a simple relationship builder tool to establish links between different tables. You don't have to be a programmer or a database expert to use the tool.

Simplified User Interface Construction

In doing the research for this product, Microsoft identified a number of common elements that tend to repeat themselves with typical business applications. For user interaction this typically involves a set number of screens for inputting, searching, editing and displaying data of some type. LightSwitch provides all of these patterns as options when you select Add New Screen.

Figure 2

LightSwitch uses a XAML-based syntax for both the screen layout and data schema definitions. It is not, however, the same XAML you would get when building a Silverlight application using the full Visual Studio experience. LightSwitch goes to great lengths to take care of the more mundane code needed to do most of the common tasks that every application must do. For example, every grid in a LightSwitch native app comes with the ability to directly export to Excel without the need to write any code.

Customizing user screens happens while the application is actually running. When you run an application, you'll see an icon in the upper right corner titled "Customize Screen." Clicking this icon brings up a Customization Mode window with a multitude of options, allowing you to change the layout of your screen. The tool uses a template system with a set of default templates for displaying typical data layouts and includes the ability to extend the templates should the need arise.

Figure 3

When you're ready to publish your app, simply follow the instructions provided from the publish option on the Build menu. That's pretty much all there is to it.

Final Notes

If you are a current MSDN subscriber, you'll be happy to know that when LightSwitch ships it will be integrated into the Visual Studio Pro and Ultimate product lines so you'll have the option when creating a new project to build a LightSwitch solution. The product will also be available as a stand-alone offering for anyone that's not a current Visual Studio or MSDN customer. Thanks for reading.