Just another Blog

My Technical, Professional and at times Personal Blog

Showing posts with label Visual Studio 2010. Show all posts

Visual Studio LightSwitch 2011–Bookstore Virtual Labs

I have been wanting to play with Visual Studio LightSwitch 2011 for a while. I thought I will give the 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:

image

Before getting started make sure the LightSwitch extension is checked:

image

Let’s go ahead and add a table:

image

This brings up the table designer:

image

Let’s add some columns to the table:

image

Using the Email Address type automatically enables validation to verify that user input for that field is a valid e-mail address.

image

Done with table definition, let’s create some screens.

Add a new screen and choose Editable Grid Screen:

image

image

Run the application and note that the application is divided into 3 regions: Ribbon, Navigation pane and Main Pane.

image

Try adding a row without a required field such as LastName and note the error notification.

image

Try providing a bad email address:

image

Lets create another table called Books:

image

For Category field, we will create a choice list:

image

Try entering non numeric values in the choice list: since category is numeric you can’t enter non-numeric values in category

image

Done, Save the project.

Now let’s create a relationship between Author and Book Entities.

Click the relationship button:

image

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.

image

Click OK:

image

Let’s add a screen to populate the Book table. Choose List and Details Screen from the list and name the screen as BooksListDetail

image

Run F5 to run the application:

image

Add a new Book:

image

image

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:

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

http://msdn.microsoft.com/en-us/lightswitch

Google+ Followers