Today during the VSLive! keynote here in Redmond I announced a new product called Microsoft® Visual Studio® LightSwitch™, which is the simplest way to build business applications for the desktop and cloud.  LightSwitch is a new member of the Visual Studio family focused on making it easy to develop line of business applications.

At their core, most end user business applications combine two things:  data + screens.  LightSwitch is optimized around making these two things very simple.  Let’s walk through a simple example which demonstrates how easy it is to get going.

Hello World

LightSwitch is a stand alone Visual Studio product (it will also be available in future versions of Visual Studio Professional and above).  VS Professional gives you a lot of options for building your application, including being able to build top tier enterprise wide apps.  This is very powerful but also presents you with a lot of options to sort out up front as you contemplate your architecture.  With LightSwitch we make it really simple with two choices:  VB or C#!

SNAGHTML27e3cfc

To demonstrate the basic features of LightSwitch, we’ll create a project to track Employees.  Since this kind of application always starts off with some form of data, LightSwitch makes it very easy to get going by giving you two choices right away:

SNAGHTML28d2bed

There is no need to go through a complicated set of database operations to get going, I’ll just select “Create new table”.  As you edit the table you’ll notice another feature, business domain data types:

image

Choosing these data types gives you data integrity checking automatically and other features.  For example if you select a PhoneNumber, LightSwitch will validate the format of the data you enter and also gives you a detailed edit form for each piece.  In this case I’ll fill out a default table with some Employee columns:

image

Creating my main data table was easy.  The next obvious step is to create a couple of screens which will allow me to edit my data.  Doing this is also very easy, simply select the +Screen button on my table:

SNAGHTML29644d9

As it turns out there are a very common set of patterns used for creating screens.  LightSwitch implements the most common screen patterns by default.  In this case I will select the “Search Data Screen” which gives me a data grid view along with Search capability.  Then simply select the Screen Data setting which points to our Employees table:

SNAGHTML2983a3f

In order to add new Employees to the table, we will also create a “New Data Screen”:

SNAGHTML29935dc

That’s it!  Now we just hit F5 to get a fully working application:

SNAGHTML29b9b23

Both new screens are present under the Tasks pane.  If you select CreateNewEmployee you can start adding new entries right away.  Notice that if you hit the down arrow on a PhoneNumber field, the domain type allows you to do detailed editing of the field automatically:

SNAGHTML2a0023f

Another common feature you can wind up spending a lot of time on is data validation.  LightSwitch makes this very easy.  For example if I enter an invalid email address, LightSwitch gives me the validation errors automatically:

SNAGHTML2aa81f9

When I pull up the SearchEmployee you’ll see a fully completed form that supports Search as well as data paging by default:

SNAGHTML2a2df54

Searching works across all the fields in the table making it easy to find what you are looking for.

Immediate Customization

Once the application is up and running we’ll want to make some tweaks to the user interface.  For typical projects this usually involves making changes to a mark up language (such as XAML or HTML), recompiling, then re-running the application.  LightSwitch makes this process simple by providing the “Customize Screen” button when you are running under the debugger.  As you press the customize button, our running screen is pushed into the upper right and we are given both a tree view of the screen elements as well as a Properties window:

SNAGHTML2e71acf

We can now make display changes, such as changing the name of the displayed columns (for example adding spaces between words or changing the column names altogether from the underlying values in the schema):

SNAGHTML2e9e426

The most interesting thing here is the application is still running.  We have not had to stop the application to make these changes, so when we hit the Save toolbar button, the designers fold away and we are now back to the running application with all of the changes already made:

image

This kind of customization really speeds up application development.

Next I can add an EmployeePicture field of type Image.  When I add the new field to the search summary screen, I get a decent layout by default:

SNAGHTML2f512d3

The layout is readable but not the best we could do.  If I switch into Customize mode, we can change the default layout to one of the default line item templates that allows for an image with detailed text:

image

After making some adjustments and saving my changes, I now get a better looking details view:

SNAGHTML2fae4d2

Office Integration

Integration with Office is another very common task in a business application.  LightSwitch makes this task easy as well.  If we look closer at our SearchEmployee screen, it has a built in “Export to Excel” option:

SNAGHTML2b0eece

In addition to exporting from Excel, you will be able to attach to your Access data, automate Word to generate new data bound documents, activate Outlook, and basically any other task you can do with the Office object model.  For example a common task is to create printed invoices using the Word document format.

Other Data, Including SharePoint

Not all of your data is stored in a single database.  Often time you need to combine data from more than one database as well as other data sources.  LightSwitch makes it easy for you to do joins across disparate data sources (internally using WCF RIA Services to serve up the data).  So as an example you can attach to a SharePoint list and create new screens that combine data from a database and SharePoint.  Being able to do this kind of data mash up is very powerful.  Being able to do the join without having to write any code is just awesome :-)

Kick Starting the Cloud

I’m sure you’ve seen that we are “All in” on the Cloud and LightSwitch is no exception.  In fact LightSwitch has been designed to target the cloud using the same set of data and screen designers I’ve shown above.  You can easily create your schema and store data using SQL Azure.  Your running business logic can be hosted in the Azure cloud meaning you never have to do administration work.  The really powerful thing about this is there is nothing special for you to do in order to run in the cloud.  You will simply do the deploy step when you are happy with your app and then point your users at the URL.  The same is true of SQL Azure:  it is just like any other database you can target.

Running in the Browser

By default LightSwitch produces a desktop application.  This kind of app can work very easily with local data and can integrate with Office as mentioned above.  Some times you will also want to give access to the application in the browser.  This is very easy using the Properties settings for the application:

image

Now when I launch the application with F5, it is brought up in my default browser (I run with IE as my default browser, but in this case I’ve shown it in FireFox to demonstrate the flexibility you have):

SNAGHTML31614c7

In this case features like “Export to Excel” are no longer enabled given we are running in a browser sand box.  But nonetheless you can see how easy it is to get going.

Extensibility

We are currently starting work with several of our Visual Studio partners to add new extensions for LightSwitch. In particular you should expect a rich set of controls for various types of data and services (such as package shipping).  At the keynote we also demonstrated a new application skin from Infragistics which has a very modern looking UI and is touch screen enabled.  Here again I don’t have to do anything special while writing the application to take advantage of the new extensibility points, I simply have to select the new skin from a drop down box.

Find Out More

In this post I’ve gone through many of the key features of LightSwitch.  One thing I didn’t show here was writing code (it is a Visual Studio product after all).  Because you are using VS, you have the full power of the framework including features line LINQ behind you.  Our goal with LightSwitch is to remove a lot of the “plumbing” work and instead allow you to concentrate on the core business logic of your application so that the code you write is exactly what you want to write and no more.

LightSwitch will not be for every developer or for every business application you write, especially if you have sophisticated needs.  At the same time LightSwitch applications themselves are robust and are built on top of .NET technologies including Entities and WCF, the same technologies you already choose from when you write your apps today.  Because the apps are built on top of .NET with VS you will be able to open your LightSwitch applications in the full version of Visual Studio and do advanced extensions.  This is very helpful when your application starts to become more popular and usage becomes wide spread and you need to do more than the core LightSwitch product supports.

You can find out more about Visual Studio LightSwitch on its new home page here.  If you are attending VSLive! here in Redmond this week please stop by the Hands on Labs section of the event and you can try out LightSwitch yourself.  Later this month we will also release a formal beta for everyone to download.

As the beta comes out later this month I will post a complete step by step tutorial on creating your first LightSwitch application so you can try it for yourself.  Enjoy!