As the cloud computing wars heat up, vendors need to provide distinct features for their customers. Visual Studio LightSwitch represents an attempt by Microsoft to deliver Access-like rapid application development capabilities to .NET Windows and Web database front-ends.
LightSwitch is an application framework and development environment for quickly building forms-over-data desktop or Web apps with minimal or no Visual Basic or C# code. It targets enterprise business analysts and power users that need networked line-of-business (LoB) apps with the data entry and analytic features of Microsoft Access and FileMaker databases or Excel worksheets but aren't programmers.
LightSwitch applications automatically generate three-tier architecture with a Silverlight 4.0 presentation tier that can run on users' desktops or implement the Model-View-ViewModel (MVVM) pattern for their Web browsers.
The middle logic tier, which includes Entity Framework (EF) v4, can be hosted on end-users' machines, on an Internet Information Services (IIS) server or, as of Beta 2, in a Windows Azure Web role. The data tier can be SQL Server, SQL Server Express, SQL Azure in the cloud, other relational databases that have an EF v4 provider, SharePoint 2010 lists, custom Windows Communication Framework (WCF) RIA Domain Services or even flat CSV files. If you don't have a data source, LightSwitch uses EF v4's model-first capability to generate a SQL Server 2008 R2 Express database.
After delivering more than 100,000 downloads of its first beta version, the Visual Studio Team released LightSwitch Beta 2 to the Web on March 15 for MSDN subscribers and March 17 for others. Users with Visual Studio 2010 Professional or higher need SP1 to install LightSwitch Beta 2; for others, the installer downloads and installs a limited-feature VS 2010 SP1 edition. Beta 2's most important new feature is the capability to publish LightSwitch apps to an enterprise-wide or departmental Windows Azure Web role easily and quickly.
Other new features of LightSwitch Beta 2 that make the framework suitable for creating enterprise-grade apps in the cloud include:
- LightSwitch Extensions, which developers with VS 2010 Pro or higher can create for use by app designers. The first two commercial Extensions vendors are Infragistics with a touch-enabled UI similar to Windows Phone 7’s and ComponentOne with a PivotTable similar to PowerPivot for Excel
- Improved run-time and design-time performance: Faster app creation, loading, startup and F5/build operations
- End-user application enhancements, including a new auto-complete control and data grids that emulate Access's user experience
- Static spans, which control whether data from related tables is included when executing a SELECT query
- Declarative unique constraints to enable specifying one or a set of two or more fields as unique, such as the OrderID and ProductID composite primary key of the Northwind Order_Details table
- Support for parameterized queries of a custom WCF RIA service that returns a single or collection of IQueryable/IEnumerable entity types (Beta 1 didn't support parameters)
LightSwitch comes with a set of five templates for auto-generating forms-over-data, called Screens, most of which are similar to Access 2010's standard LoB form templates. These are the standard Screen designs:
- Details displays a single entity's values in editable text boxes and its child entities, if any, in an editable grid. Details Screens don't appear in the navigation pane.
- Editable Grid enables editing one or more records in a databound grid, which corresponds to Access's datasheet view.
- List and Details displays a list of entities in the left pane. Selecting a list item displays its field values in editable text boxes. You can add a grid below the Details section with child data sorted in descending date order, as shown in Figure 2.
- New Data is a dialog with text boxes to enter data for a new or child record.
- Search Data is a dialog that lets you search query results and open matching record(s).
LightSwitch offers built-in Windows and forms authentication features. Windows authentication, which is best suited for data center or hybrid cloud deployment, enables any authenticated Windows user to use the app. Alternatively, use can be restricted to Windows users who appear in the Users screen. ASP.NET-style forms authentication is available for cloud access by business partners. Granular role-based, screen-level authorization can authorize role members to access an entity set and then view, add, edit, and/or delete a specific entity.
The LightSwitch team promises support for Access databases in the released product. But to compete with Access's rapid application development (RAD) features, the LightSwitch team must offer pre-built application templates and databases, not just screens, which users can customize easily and quickly for common tracking tasks.
For example, Access 2010 comes with built-in Assets, Charitable Contributions, Contacts, Events, Faculty, Issues, Marketing Projects, Sales Pipeline, Students and Tasks application templates. Office Online offers many more templates for conventional desktop databases, as well as ones for creating Access 2010 Web Databases that you can deploy to SharePoint 2010's Access Services on premises or hosted by a multi-tenanted cloud service for Internet access.
I was able to deploy a complex Northwind sample database from an Office Online template to an Internet-facing Web Database hosted by PaaS provider AccessHosting.com in less than five minutes; a simpler Contacts deployment took less than two minutes. Based on my experience so far with LightSwitch Beta 1 and 2, it would take several hours to create and deploy a LightSwitch duplicate of the Northwind project and at least an hour to emulate the Contacts database.
Both Access and LightSwitch can serve as front ends for SharePoint 2010 lists, which SharePoint exposes in the Open Data Protocol (OData) format. However, you'll incur incompatibility errors with SharePoint as a LightSwitch data source if you create the lists by upsizing Access databases. This problem isn't fixed by Office 2010 SP1 or LightSwitch Beta 2.
LightSwitch Beta 2 is still missing printing and reporting capabilities, but third parties might fill that gap with LightSwitch Extensions. The LightSwitch team should integrate SQL Server Reporting Services, as the Access team did with Web Databases, or offer an alternative approach to printing reports as soon as possible.
Despite its Beta 2 limitations, LightSwitch appears to me to be the easiest and least costly route to creating enterprise-quality data-intensive SilverLight 4 Web apps for deployment to private, hybrid or public clouds. Take advantage of the LightSwitch Team's comprehensive development resources, which have recently been upgraded to Beta 2, to develop and deploy LoB apps to Windows Azure.
ABOUT THE AUTHOR:
Roger Jennings is a data-oriented .NET developer and writer, the principal consultant of OakLeaf Systems and curator of the OakLeaf Systems blog. He's also the author of 30+ books on the Windows Azure Platform, Microsoft operating systems (Windows NT and 2000 Server), databases (SQL Azure, SQL Server and Access), .NET data access, Web services and InfoPath 2003. His books have more than 1.25 million English copies in print and have been translated into 20+ languages.
This was first published in April 2011