US / UK-EMEA / Contact Ask DevelopMentor a Question800.699.1932

Visual Studio LightSwitch

August 2010
A Lightning Round with Visual Studio LightSwitch

by Michael Kennedy

On August 3rd, 2010 Microsoft announced a very different, dare I say controversial skew of Visual Studio which had been hiding behind the code name Kitty Hawk now known as Visual Studio LightSwitch.

In this article I will give you a quick glance at building RAD business applications based on Silverlight 4, MVVM, WCF, and Entity Framework using this new tool. My goal is to show you my experience building out a quick and dirty forms-over-data app using LightSwitch with virtually no prior experience.

I won't give you a thorough deep-dive as Jason Zander has already done that. Rather this will give you the first 10 minutes experience.
LightSwitch is not out yet - even in CTP format. It's going to be released on August 23rd.

But was available for hands on lab at VS Live. What follows is my experience building a simple data driven application which several related tables and some nice UIs with validation. The sum total of time taken is 10 minutes and that's about the amount of prior experience I had with it.
Step 1: Starting LightSwitch
Looks like Visual Studio 2010.


Step 2: Creating a Project
The choice is simple to create a new project: VB or C#?


Step 3:
Once you create a new project, you have the simple option of creating a new database or connecting to an existing data source (SQL, SQL Azure, SharePoint or a custom source via WCF Services). I chose to create a new one.


Step 4:
I want to model investors and their investments. So here I define an investor table with higher-order primitives such as Money columns. These make their way to the UI seamlessly.


Step 5:
The solution options are simple. I can manage my data sources and tables as well as UIs for them (screens).


Step 6:
You can add a few common data scenarios: search, create, edit, master / details.


Step 7:
An investor screen. Here you'll see a big difference around how the UI is surfaced. There is an abstraction around how to show the UI, no working in low level details. This means there are many options for theming and allowing the system to optimize for scenarios such as Windows vs. touch UIs.


Step 8:
There are a rich set of pre-built visualizers around types.


Step 9:
Relations are natural and plain English. Here "an investor must have an investment." See the text at the bottom of the dialog.


Step 10:
The relations show in the table designer.


Step 11:
You can create screens that work with these relations and get a lot for free.


Step 12:
Running the app (this is my new app's UI) you get a professional looking Silerlight 4 application which comes with much of the CRUD operations. This dialog let's me add a new investor.


Step 13:
Many of the default UI elements are polished and have validation.


Step 14:
Here is the details part of master / details.


Step 15:
How tired are you of writing data validation? This is a refreshing sight to see this requirement making its way to the UI via the underlying MVVM and DataAnnotations with elegant feedback.


Step 16:
Browsing relations is built-in and very easy.


Step 17:
This dialog lets us associate an investor with the investment. The only two are Bill and Ted here. It comes with search and paging.


Step 18:
Associating Ted with this investment in Apple stock clears the UI errors.


Step 19:
We even get "dirty" tracking for free. Notice the '*'.


Step 20:
Pressing save clears the dirty flag.


Step 21:
Here's the final screenshot. Notice the nice multi-tabbed UI and the orange "Customize View" for on the fly UI design.


Conclusion
There you have it: 10 minutes and little experience and we have a fairly polished UI built on a fairly solid technical foundation of Sliverlight, MVVM, and WCF.

Many people have complained that LightSwitch will reek architectural havoc on the software industry. That may be true some of the time. But then again how much fun are basic forms-over-data apps to build with nice UIs and validation? How much scalability do you really need?

I say save your energy for the really exciting and challenging projects such as a good MVC / JQuery website or elegant service. Use LightSwitch to get the quick and dirty data management apps knocked out and focus on the big fish with your professional tools.

That's my two cents. Feel free to continue the conversation with me on Twitter: @mkennedy.
Connect
Signup for our Free Newsletter!
Latest news
Twitter Feed MORE
Got an email from a developer in Holland about my Onion Architecture blog post http://t.co/Z5DTvJob Nice to have a worldwide audience! #dm
1 day ago (details)
There is something to this statement: Why Quit? Because They Have Bigger Monitors http://t.co/9FrGETG5 #dm (via @mkennedy)
2 days ago (details)
Testimonials
  • Rod da Silva felt very confident in his product knowledge and experience. Bob C.