I have been wanting to play with Visual Studio LightSwitch 2011 for a while. I thought I will give the virtual labs a try. So, here is my take away from the virtual lab.
LightSwitch is the fastest way to build database applications for the desktop and the cloud. it is a new development tool designed to simplify and shorten the development of typical forms-over-data business applications. LightSwitch simplifies the development process, letting you concentrate on the business logic and doing much of the remaining work for you. By using LightSwitch, an application can be designed, built, tested, and in your user’s hands quickly.
Let’s start with a new LightSwitch Project:
Before getting started make sure the LightSwitch extension is checked:
Let’s go ahead and add a table:
This brings up the table designer:
Let’s add some columns to the table:
Using the Email Address type automatically enables validation to verify that user input for that field is a valid e-mail address.
Done with table definition, let’s create some screens.
Add a new screen and choose Editable Grid Screen:
Run the application and note that the application is divided into 3 regions: Ribbon, Navigation pane and Main Pane.
Try adding a row without a required field such as LastName and note the error notification.
Try providing a bad email address:
Lets create another table called Books:
For Category field, we will create a choice list:
Try entering non numeric values in the choice list: since category is numeric you can’t enter non-numeric values in category
Done, Save the project.
Now let’s create a relationship between Author and Book Entities.
Click the relationship button:
In reality a book can have more than one author, but for this exercise we will consider it is 1:many. A Author can have many Books.
Click OK:
Let’s add a screen to populate the Book table. Choose List and Details Screen from the list and name the screen as BooksListDetail
Run F5 to run the application:
Add a new Book:
Summary:
We created a basic LightSwitch application and used LightSwitch’s main functionalities. We created two Tables with different properties to represent the elements (Books/Authors) of our application. Created a relationship between Books and Authors. Used special types such as EmailAddress, PhoneNumber and choice lists as property types for those elements. We created screens to display and edit the data. We didn’t write a single line of code to accomplish all of this!
References:
Visual Studio LightSwitch 2011
Starter Kits: http://www.microsoft.com/visualstudio/en-us/lightswitch/starter-kits
Beth Massi Videos:
http://blogs.msdn.com/b/bethmassi/archive/2010/08/24/visual-studio-lightswitch-how-do-i-videos.aspx
LightSwitch Developer Center