By Tim Leung

What's the most exciting feature in the Visual Studio 11 (VS11) Beta? Although VS11 includes plenty for you to discover and learn, one of the more interesting features is that it gives you a preview of what's to come in the next release of LightSwitch. But if you've never heard of LightSwitch, don't worry! In this article, I'll explain what LightSwitch does and describe some of the new features that you'll find in VS11.

LightSwitch allows you to write data centric applications that you can run either on the desktop or through a web browser. A key feature is that it allows you to create simple applications without having to write a single line of code. It includes a graphical designer that allows you to create tables for data storage. You can also create Data Queries and Screens (for user interaction) by using a graphical designer.

More experienced developers might not have much confidence in a rapid application development tool that allows you to create applications without code. They might think that such a tool would produce applications of a lesser quality. But with LightSwitch, that's certainly not the case. Beneath the surface, LightSwitch uses enterprise level technology that includes RIA Services, LINQ, Entity Framework, and MVVM. This allows more experienced developers to extend their LightSwitch applications by using well known and familiar technologies

The latest preview of LightSwitch offers improvements in several key areas. Here are some of the best features that you'll find in VS11.

1. Better support for data

LightSwitch applications can connect to existing data and several data sources are already supported. Version 1 supported SQL Server, SQL Azure, SharePoint 2010, and any data source with a compatible Entity Framework provider. But in VS11, LightSwitch's support for data gets even better.

VS11 now adds support for OData (Open Data Protocol). Many modern web sites and applications expose their data using OData. (eBay, Windows Live, and Stack Overflow are some examples). OData support means that you work with a far greater variety of data sources.

However, you're not just limited to consuming data from external data sources using OData. LightSwitch now exposes the data that you've defined in your tables via its own OData feed. This allows you to manage your LightSwitch data using other applications such as Excel.

2. New Business Types

LightSwitch allows you to create data columns in your tables using standard data types such as string, integer, and date. But in addition to these standard data types, LightSwitch also provides enhanced data types which are known as 'business types'.

In version 1, these business types included email, money, and phone number. When you define a table column using a Business Type, LightSwitch automatically validates the format of the data that's entered by the user and also provides tailored controls for data entry. It does this without you having to do any extra work.

VS11 introduces the Percent and Web Address Business Types. If you need to work with such data types, the new LightSwitch business types will make your job much simpler.

3. User Interface Improvements

You can very quickly develop Screens on-top of the tables in your application. To do this, you'd simply select your table and choose from one of the built-in templates. The 'New Data' template creates a screen that allows users to enter records one at a time whereas the 'Editable Grid Screen' template presents your data using a data grid. The screens that are generated in this way are good to go. But if you want to further customise the appearance of your screen, VS11 includes a handful of new UI controls.

New to VS11 is the Group Box control. This allows you to organise your controls into a section that's labelled with a heading. Also new to VS11 are the Embedded Text and Embedded Image controls. These controls provide a feature that was missing in version 1 - the ability to add static text and images onto your screens. These 'embedded' controls now make it much easier for you to create good looking screens.

4. Formatting Numbers and Dates

In version 1, you needed to carry out various workarounds if you wanted to format numbers and dates in a specific way. But in VS11, you can format numbers and dates by simply supplying a .NET format string.

Formatting data in this way was a suggestion that I added through Microsoft Connect in 2011 so I'm really pleased that this feature has made it into VS11.

5. Changes behind the Covers

VS11 also includes various changes to improve the reliability of LightSwitch. For example, version 1 uses SQL Server Express. VS11 now replaces this with SQL 2012's LocalDB database which solves much of the problems that you might have encountered with SQL Express. The number of individual projects that make up a LightSwitch solution has also been simplified. In version 1, LightSwitch stores your work in an underlying 'LSML' file (under normal circumstances, you don't need to know anything about this file to use LightSwitch). The reliance on a single LSML file can cause problems and VS11 improves this by reorganising the contents into 3 separate files.

To summarise, this article has hopefully given you an insight in LightSwitch and how you can use it to quickly develop data driven applications.

So whilst you're exploring Visual Studio 11 Beta, now's an ideal time to try out LightSwitch. To get started, simply download VS11 Beta and visit the LightSwitch developer centre to find out more.

TimLeungMediumTim Leung
Software developer

Tim Leung is a software developer based in the UK. For the past 12 years, he has specialised in enterprise application development using products from the Microsoft technology stack. In particular, he possesses deep knowledge of the Microsoft .NET Framework and SQL Server. He's an active member of the U.K. developer community and helps to run the UK VBUG User Group. Tim is passionate about LightSwitch and rapid application development. He is the co-author of the book 'Pro Visual Studio LightSwitch 2011 Development' (published by Apress).