Visual Studio LightSwitch Beta 2 – Where Have You Been All My Life
[This article was contributed by the SQL Azure team.]
Visual Studio LightSwitch Beta 2 was released earlier this week and is now available for public download. LightSwitch applications utilize Silverlight that can be run in the browser or on the desktop. Beta 2 introduced new capabilities to deploy to Windows Azure and SQL Azure so I decided I really needed to give it a try.
Never having used the tool before, after 2 hours I was really impressed. LightSwitch helped me design a simple database, create the user screens, implemented basic field validation, and deployed it to Windows Azure. Amazing. Next week I'll post some video of the app I created and the LightSwitch development experience.
It is really easy to use for writing and deploying CRUD (Create, Read, Update, Delete) data-driven applications to Windows Azure and SQL Azure and is best suited for departmental and business applications. For business analysts and non-professional developers this is a fantastic tool that requires extremely little knowledge of coding or .NET. In the sample app I created I only wrote one line of code. Used in conjunction with currently CTP SQL Azure services such as SQL Azure Reporting and SQL Azure Data Sync, using Visual Studio LightSwitch is going to make it incredibly easy to quickly write hybrid applications for departmental and small business scenarios.
You can read more details about LightSwitch in blog posts from Jason Zander and Somasegar. Below are more detailed notes of my experience using it, and screenshots of the app I created and of LightSwitch development itself. Enjoy!
So Easy a Caveman, or Cavewomen Can Do It
As a quick test, I created an application that records a grocery list that can be accessed by my wife and I.
All within the LightSwitch experience:
- I designed the database visually (ok, only two tables)
- Created three screens for CRUD operations, adding stores, grocery items, and viewing grocery items by store
- I only ended up writing one line of .NET in the entire app to compute a calculated field
- Deployed the database schema to SQL Azure, and the application to Windows Azure in the final Publish step without having to edit any config files.
I did this start to finish in less than 2 hours without ever using the tool before or reading any tutorial documentation.
Screenshot of the LightSwitch application I deployed to Windows Azure and SQL Azure
Setup & Installation - A Lot Easier
Download and installation of LightSwitch Beta 2 was straightforward. No other tools required. No additional SDKs were needed for Azure deployment, nor any additional tools for connectivity to SQL Server or SQL Azure. This is a lot easier than configuring the development environment for a web/worker role deployment and installing SSMS (SQL Server Management Studio) for SQL Azure/Server development.
If you already have Visual Studio 2010 installed, LightSwitch becomes another project type within the VS experience.
Development - Different, But Easy
LightSwitch is all about writing data-driven applications. When authoring a LightSwitch app, you can connect to an existing database, SharePoint sites, or WCF RIA Services; the SQL Azure/Server experience is very clean and easy to use. Creating a greenfield application and designing the database is also incredibly easy and productive. It includes a friendly entity modeler that works against SQL Express, SQL Server, and SQL Azure, utilizing common data types like string, integer, date - but also data types in 'human' terms, such as "Email" and "PhoneNumber" which are stored as nvarchar in the database, but LightSwitch provides validation to make sure those fields are entered correctly with regexp expressions in the background. The database schema that's created is completely readable, in 3rd normal form, and can be easily used by other developers writing against the database or to write reports with for SQL Azure Reporting or on-premises SQL Server Reporting Services.
LightSwitch table designer
The most interesting development paradigm in LightSwitch is that the screens are driven completely by the data. There are no traditional form designers for layout, after you select one of a few wizard types LightSwitch creates the screens and data-bindings automatically. Customization in regards to fonts and layout are intentionally constrained for purposes of productivity and less complexity. I only went to code view once, to calculate subtotals for each grocery item based on quantity.
UX customization can be done at design time or run-time by an administrator via a Silverlight designer.
LightSwitch form designer
Deployment - Did I Say Easy a Lot Already? I'll Say It Again. Easy.
LightSwitch applications are Silverlight based, and can be deployed to the desktop, IIS, or Windows Azure - all configurable via radio boxes in the Publish Wizard. Provided a user already has an Azure account, it's a matter of cutting and pasting in subscription information to the Windows Azure account, and connection string information to the SQL Azure database. Of course, you can also choose to deploy to an IIS server and a SQL Azure database as well.
This is straightforward, but it does require already having an account, having security certificates deployed, and provisioning an empty Windows Azure service and SQL Azure database. LightSwitch made this as easy as possible. After clicking 'Publish', it all deployed to Windows Azure in a matter of minutes and was very straightforward. I didn't have to open or edit one XML configuration file throughout the whole process.
Deploying the database schema to SQL Azure was completely seamless and transparent. It doesn't deploy data - just schema, but "it just works" . This was very impressive - no need to create and run scripts to implement the schema.
LightSwitch Publish Application Wizard
Security & Authorization
For on-premises deployments, Windows and Forms authentication are available. For Windows Azure deployment, Forms Authentication is the only option. Forms Authentication utilizes the same authentication mechanism from ASP.NET and created seven "aspnet_x" tables in my SQL Azure database for storing roles and user information. Administration screens are included in the LightSwitch app, accessible to a user identified as the administrator when the app is published within LightSwitch.
User and Role Administration within a LightSwitch application
I was really amazed how productive I was using LightSwitch to write an app and deploy it. I encourage you to try it out. I'll be writing some follow-up posts showing how quickly you can get started using it with SQL Azure.