Code Focused

Is Visual Studio LightSwitch the New Access?

The LightSwitch RAD platform generates apps with "no coding required." What's in it for you? .NET apps that are easier to maintain and extensions built on the Managed Extensibility Framework.

Microsoft publicly released beta 2 of LightSwitch, code-named "Kitty Hawk," in March. The technology is designed to make building line-of-business (LOB) applications easier through pre-built templates and custom business data types, with the ability to deploy to the desktop, the Web and the cloud. LightSwitch beta 2 has better performance and introduces an auto-complete control, flexible layout controls, an Excel-like grid, unique constraints for fields, an "all users" windows authorization level, support for custom data sources, the ability to deploy to Windows Azure and more. Before we look at the solution, let's take a look at the problem it's intended to solve.

Departmental App Attack
In an all-too-familiar scenario, you receive a critical support request from an LOB department to fix issues with a Microsoft Access application. That application began as a simple collection of forms with some reports. It has since morphed into a business-critical application straining under the weight of an increasing user count, stricter security requirements, interface needs, increasingly complex business rules and the need to expose the data via the Internet. These issues can manifest and result in data corruption, ever-slower queries, unauthorized access to app features and complex multitable macros. It's often difficult to get all of the users out of the Access database to do a Compact and Repair.

As a corporate developer or external consultant, you're presented with a collection of tables, temporary tables, macros, Visual Basic for Applications (VBA) routines, forms and reports that don't easily translate into the professional development environment of the Microsoft .NET Framework and SQL Server. When this happens, you're faced with essentially two choices:

  • Upsize the data storage to SQL Server and keep the front-end in Access; address any remaining performance or security issues.
  • Rewrite the application in .NET with a SQL Server back-end.

Neither choice can be considered a convenient migration path from Microsoft Access. Visual FoxPro is another tool often used by non-professional programmers that can create a similar situation. To a lesser degree, similar departmental application issues can occur with Excel workbooks developed by technically skilled end users.

This is not to say that all departmental apps should be strictly banned. IT departments will always have backlog, and department staff need a way to resolve their automation issues when they can't get priority with corporate development.

Bring Departmental Apps into .NET
LightSwitch is targeted to provide a tool for non-professional programmers to develop forms-over-data departmental applications that are both easy to use and corporate-development friendly. Don't confuse LightSwitch with the recently released WebMatrix product. WebMatrix makes it easy to create new Web sites or use the Microsoft Web Application Gallery to customize ASP.NET and PHP open source applications. LightSwitch is an LOB development tool that can integrate data from multiple sources and is purely a .NET Framework-based platform.

This application generator can be used to better address many common business automation needs for which Access might otherwise have been used. It provides simplified development through screen templates (Figure 1), a user-friendly table designer with business data types (Figure 2) and an interactive screen designer. LightSwitch applications can be easily deployed to the desktop, the Web or Windows Azure. Note that LightSwitch beta 2 comes with a Go Live license and can be considered for production applications.

[Click on image for larger view.]
Figure 1. The LightSwitch Add New Screen dialog.

LightSwitch runs on the .NET Framework and uses the Visual Studio project structure. Custom code is written in C# or Visual Basic rather than VBA. Both languages provide full access to the capabilities of the LightSwitch environment.

For example, Visual Basic can be used to easily extend database field behavior. Consider the need for an uppercase-only database string field. There's no force-uppercase property in the table designer (shown in Figure 2), but you can easily add that behavior by clicking on the Write Code button and choosing the Field1_Changed event. LightSwitch presents a blank method. Adding the highlighted single line of code Field1 = Field1.ToUpper() will ensure that the contents of that field are converted to uppercase whenever the user edits the field on any screen in the application:

[Click on image for larger view.]
Figure 2. The LightSwitch table designer.
          PrivateSub Field1_Changed()
               Field1 = Field1.ToUpper()

LightSwitch can participate in source code control via the integrated Visual Studio Team Edition Explorer. It uses SQL Server Express for its local data store at design time; deployed applications can use SQL Server Express, SQL Server or SQL Azure. If you have sufficient permissions via the data connection, you can create tables on the remote data source via the LightSwitch data editor.

The LightSwitch UI is presented in Silverlight 4 and architecturally follows the Model-View-ViewModel (MVVM) pattern. MVVM provides the ability to do effective unit testing through separation of concerns. The Model supplies the data for the application, the View provides the UI and the View-Model serves as the link between them. Note that, due to the MVVM architecture, application code can't directly access the Model (data layer) from the screen (View). More information on the MVVM pattern can be found in the VSM cover story, "6 Tips of Separation: Take ViewModel for a Spin and Test Your Silverlight Apps" (April 2011).

A departmental developer can install LightSwitch without the need for Visual Studio. For users of Visual Studio 2010 Professional (or higher), install LightSwitch but note that the Visual Studio 2010 SP1 update is a prerequisite. The LightSwitch runtime and LightSwitch project templates will become available within Visual Studio 2010 after installation. Applications developed in the standalone LightSwitch designer can then be opened in Visual Studio.

Extending LightSwitch
As a new product, the LightSwitch team is focused on building core functionality, and it's reasonable to expect that to be fully productive, some custom extensions will need to be written to fill the gaps that are inevitable in a first-generation product.

Fortunately, custom extensions can be uploaded to the Visual Studio Gallery and shared with other developers, so useful extensions should appear rapidly.

Custom extensions can be written in either C# or Visual Basic with Visual Studio 2010 Professional (or higher). Extensions provide a design-time experience, runtime experience or both. Multiple extensions can be combined in an application. The six available extensibility points for LightSwitch are:

  • Business Type
  • Control
  • Custom Data Source
  • Screen Templates
  • Shell
  • Theme

Business Types are custom data types that appear in Visual Studio for the first time in LightSwitch. They incorporate validation rules, data formats and the data value under a business-friendly alias. Native business types in LightSwitch include Email Address, Image, Money and Phone Number.

Business Types are validated on the client in order to provide immediate feedback to the user. If the client validations pass, the business types are then validated again upon the server to ensure clean data and apply any additional validations that may require server interaction. Custom Business Types will be shown among the available data types in the table designer.

The Control extension is essentially a Silverlight control configured for the LightSwitch environment. A description of the supported UI control types is shown in Table 1.

Value Description
Value Represents a style for a specific, scalar, simple data type. This is visualized using a single control.
Details Represents a content item for an entity or complex type. This may be visualized using a single control or as individual fields using the node's children (if there are no children in metadata, they'll be automatically created by the system, if needed).
Command Represents a command content item. This may use a style like a button or link.
Collection Represents a collection content item (using styles like Grid, ListBox an more).
Group Represents a group content item (using styles like TableLayout).
Screen Represents a screen.
ScreenContent Represent a node that always binds to the screen. Useful for custom controls.

Table 1 UI Control extension types supported by LightSwitch.

Custom UI Controls are selected by choosing "Custom Control" in the screen designer.

LightSwitch beta 2 natively supports data access to SQL Azure, SharePoint 2010 lists, SQL Server Express, SQL Server, the Entity Framework Provider and WCF RIA Services. Any other data source needed by a LightSwitch application must be wrapped in a WCF RIA Services DomainService. Custom Data Sources can be consumed by choosing the "WCF RIA Service" Data Source Type option of the Attach Data Source Wizard.

Screen Templates provide a stencil or pattern for the layout of controls on a screen. The templates are copied into the application when used and not linked to the source template. Thus, the source templates can be modified or removed in the LightSwitch visual designer without affecting screens that have already used the template. Custom screen templates will appear in the list of available Screen Templates in the Add New Screen dialog.

The Shell represents the look and feel of the LightSwitch application.

It's made up of three parts: the Navigation Pane on the left, the Command Pane on the top and the Active Screen page in the lower-right area that comprises the majority of the screen. The locations can be changed and reshaped by the Shell extension; for instance, the Navigation Pane can be shown at the right or bottom of the screen, if desired. A custom Shell can be selected in the General Properties tab of the Project property pages, as shown in Figure 3.

[Click on image for larger view.]
Figure 3. Shell and Theme selection.

A Theme is a color and font palette organized as a dictionary collection. The keys are the same as the ones used for the default built-in Shell and Theme, and in this way, they replace the existing look. Unique keys for a custom Shell can be defined, but you should always expose the built-in keys at a minimum in addition to any custom keys. A custom Theme can be selected in the General Properties tab of the Project property pages.

For example, an UpperCase Business Type extension could be created that would error unless all the alphabetic characters entered in the field are uppercase. While defining a Business Type extension requires significantly more coding, it would have the advantage of being available as a data type for use within any table definition.

Packaging LightSwitch Extensions
Once you've completed development of one or more extensions, you'll need a way to distribute them to the developer for use.

LightSwitch extensions are packaged into an .LsPkg format, which is then enclosed in a .vsix file. Like Silverlight .xap files, you can rename .LsPkg files with the .zip file extension and examine the contents. To be identified as a LightSwitch package, the .vsix package manifest must be marked as "VSLS" under "Additional Visual Studio Products" in the "Supported VS Editions" setting of the manifest. This will be set automatically for you if you use the VSLS Extensibility project types in Visual Studio 2010.

LightSwitch .vsix files can be installed on a PC with LightSwitch by downloading and executing them, or from the Visual Studio Online Gallery with the Visual Studio Extension Manager. To use a custom extension within LightSwitch, select the extension from the Extensions tab of the application's Properties page.

Is LightSwitch the New Access?
How does LightSwitch stack up as an alternative to departmental development tools such as Microsoft Access or Visual FoxPro? To be fair, LightSwitch is a beta 2 version at the time of this writing and will gain many important features in the future.

In its current form, LightSwitch excels in some areas:

  • It can deploy to the desktop, a Web site or SQL Azure as a deployment stage choice.
  • It can easily consume data provided by WCF RIA Services.
  • The LightSwitch environment has clearly defined extension points for enhanced functionality or appearance.
  • LightSwitch applications can run on any platform that fully supports the Silverlight 4 runtime. The technology currently has some limitations:
  • Microsoft Access is a full Windows client application. LightSwitch Web applications run in the security sandbox of the browser and, even when deployed as a Windows application, have limitations on what can be run or accessed in the local environment.
  • LightSwitch doesn't have a native report designer or reporting model. The LightSwitch Suite of Controls project provides a LightSwitch control extension that hosts the page generated from Reporting Services for full Web reporting functionality.
  • LightSwitch does not deploy to mobiles devices such as Windows Phone 7.

The need for departmental applications simply will never go away. Users will always find a way to build what they need when faced with long delays from the corporate development staff. The pain comes when the departmental application "hits the wall" and IT is asked to maintain it, or worse, extend it. In that situation, IT will be much better off when presented with an application developed in LightSwitch versus the other possibilities. Inheriting an application built with LightSwitch means inheriting a .NET-based application, built on standard best practices such as n-tier architecture, data in SQL Server, proper data architecture, validation in the appropriate tiers and so on. IT departments should closely evaluate LightSwitch and consider training and supporting departmental developers in its use. The pain you save could be your own.

You can develop custom extensions to ease LightSwitch development within corporate standards. Extensions with wide appeal can be uploaded to the Visual Studio Gallery and shared with others.

With LightSwitch, Microsoft developed a completely new platform to bring .NET into Rapid Application Development. Should Microsoft instead have put its resources into a new version of Access, "Access.NET," that delivers the full suite of the familiar and easy-to-use Access development tools in a .NET environment?

What do you think? I invite you to use the comment section to share your thoughts and experiences.

comments powered by Disqus

Reader Comments:

Wed, Apr 11, 2012 CGC

Acees IS a reporting tool which comes with its own data storage and data capture. If LS does not have a built in reporting tool then it can't compete with Access. I don't like Access, but it is still the best reporting tool out there.

Fri, Jul 15, 2011 Joel London

Access is brilliant. would be amazing. Visual studio will never be as rapid at developing apps as Access. Mind you, Access 2010 is a lot slower at development than 2003. Microsoft have spent a lot of time adding bells and whistles to Access with the end-user in mind, but I reckon most of Microsoft's direct Access customers are developers. I would glady pay £10 for each license of runtime rather than get a free COM runtime.

Tue, Jun 21, 2011 Dave

When will we see LightSwitch Express for those of us that are not going to get their company to spring for a full blown Visual Studio 2010?

Tue, Jun 7, 2011 jess_wundring Alaska

Lightswitch has me REALLY excited. Access is great, but can be incredibly frustrating for someone with a developer's background. Here where I work, everybody wears many hats and we simply don't have the manpower to do *real* development, yet we do have the need for apps that simply aren't available off-the-shelf. Lightswitch has a huge amount of promise...I've just started dabbling with it, a few days ago, in preparation for my next project (due in about 3 weeks) and I LIKE IT ALOT! I intend to take advantage of the "Go Live" licensing option.

Fri, May 20, 2011

>>"Should Microsoft instead have put its resources into a new version of Access, "Access.NET," that delivers the full suite of the familiar and easy-to-use Access development tools in a .NET environment?" There are no words to describe the degree to which "Yes" is not only an understatement in response to that question, but also the degree to which it is so LONG overdue. I have been an Access developer in a large major city government setting for about 10 whole years now. While I take small steps to learn ASP.NET when I can, the enormous time and money invested in my development with Access and VBA has been greatly and sadly wasted to a large degree by the reality that an Access.NET evolution has not already been decided upon and implemented long ago. Multiply that by many thousands and perhaps even millions of developers and advanced users, and it is a vast waste, loss, and impediment indeed if simply switching over wholesale to the more desirable ASP.NET and client/server is not necessarily just a quick convenient piece of cake for everyone equally to do. Frankly, it's almost as if Access and VBA and the vast population of Access developers have been largely abandoned. Amazingly, XP/2002 is still the best development option available in my particular context; 2007 has been partly implemented agency-wide, and has frankly at times been more of a time and money draining disaster and big step backwards, especially as valuable features such as user level security have even been thrown overboard (and do I even need to start mentioning the "ribbon"); 2010 is not available at all, but from what I have read about it, it does not appear by any means to be even close to the kind of truly flexible Web and .NET enabling option one would really want at all anyway. Amazingly, for example, to this day nothing as basic and simple a software update as an option to enable wrapping code text and making similar text customizations in the VBA editor has ever been provided, sometimes one of the most work hindering, time and money wasting realities I could ever imagine still being in place after all this time, and one which often requires copying code to even a FREE editor that does so before moving it back to the Access application. I am writing this as one who still remains very much a supporter of Microsoft software and its remarkable revolutionary impact worldwide, but I sure wish "Access.NET" and the vast population of Access developers out there had by now received the kind of progress, prioritization and attention that seems so warranted and so long overdue. It would also be an understatement to mention just how welcome it would be.

Wed, May 18, 2011

I think lightswitch is a great idea. I use Access in my business and lightswitch is what I am looking for. A product that can help my growing business make the leap from over-customizing Office, to developing an in-house IT department utilizing business specific apps built with tools future professionals can plug into and extend into full blown .NET applications.

Mon, May 9, 2011

Should Microsoft instead have put its resources into a new version of Access, "Access.NET," that delivers the full suite of the familiar and easy-to-use Access development tools in a .NET environment?

An emphatic YES!!! :-) Because LightSwitch will go the way of the Dodo, like VFP did.

Thu, May 5, 2011 Inak

@Garry - I disagree. The company I'm with could benefit a great deal from more departmental applications that automate or streamline processes. While saving 3 or 4 people an hour or so a week might not be a big return, 5 or 6 apps doing the same thing does add up. Since the financial crisis began, we've downsized our IT areas to where we're doing very little new coding at all. With some training, some of the more technically savvy users in each department could be trained to do some of this development in something like LightSwitch with IT providing guidance as needed. The apps probably wouldn't be as efficient as those writting by "professional" programmers but it would still be much better than a manual process.

Thu, May 5, 2011 Richard Gump Texas

I agree with Albert Kallal. Access is super. If anything, keep expanding Access not adding tools that will take 2 or more years to catch up.

Thu, May 5, 2011 Garry@TriSys Cambridge UK

I am not sure that there will indeed always be a requirement for departmental apps as you suggest. has proved that internal departments no longer have to wait for the IT department to build bespoke systems. Many other vendors have built cloud based products/services which can be used by departments and the apps market is thriving and growing. The world has changed and business people can buy rather than build. Also, Microsoft is no longer interested in plug-in apps based around Silverlight, prefering instead HTML5 and javascript. My guess is that LightSwitch is doomed to fail for these reasons.

Wed, May 4, 2011 Albert D. Kallal Canada

The great part of is the ability for the web. The downside is going to be what coding enviroment that the supposed non coder is going to use and learn? Are they to install VS? The other monkey wrench here is of course that Access 2010 supports web publsihing and will also be supported with office 365. With the advent of web publishing in Access, then all issues of deployment go away. And what is really nice is that Access web forms and reports do not require any silverlight nor ActiveX. So, these forms currently work on my iPad and even on my windows 7 smartphone. In fact, I tested the Access forms on Linux using FireFox and they worked perfect. So, this idea of a easy to use system that lets you produce web forms is exactly what Access 2010 has now anyway. Here is a video I made, and at half way, I switch to using the Access applciation 100% in a web browser. There was no 3rd party tools used here, but just web forms in Access. Albert D. Kallal (Access MVP) Edmonton, Alberta Canada

Add Your Comments Now:

Your Name:(optional)
Your Email:(optional)
Your Location:(optional)
Please type the letters/numbers you see above

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.