Lightswitch Demo Application

Okay, as promised, here is a small demo application I created with Visual Studio Lightswitch. This will be my way of drilling down into what Lightswitch can do and what you, as a developer can do with it so don’t expect Hello World ok?

I’ll create a simple data driven application that stores the information about a small Movie collection. I’ll save the movie’s Title (of course), genre, director, actor and MTRCB rating. We will also maintain the tables for each tuple like an Actors table, a Directors table and for all the other needed data.

So for this, we start off with me having a VS-LS application already started off but with no screens yet.

Here is what I have now:

It’s pretty basic, I just want to highlight a few things. The actors table has two “different” data types that you will see. The first one is the emailaddress, and the next one is the phonenumber. Visual Studio Lightswitch gives you, as the developer, these data types that you can use. What is so important about these? Well when lightswitch generates the screens for this table, it will use these datatypes for data entry validation. So if you need to validate entry to be a valid email address or email address format, you will not need to write any regular expressions or any code to perform these.

Ill add a few screens to this app after I add a few more tables that will be needed and we will have this:

Here I created a screen to handle the creation of a new Classification (classification being the rating that MTRCB gives a movie). I have highlighted three areas to illustrate a few things that for me is worth noticing.

First, take notice the left side of the screen. That list can be considered as the view model of the screen. It shows you all the data that can be used on the screen. So if this the view, how then do we illustrate where the middle layer code resides? Look at the right portion of the screenshot and I highlighted how to add some code to a VS LS application. The tooltip tells us that whatever code we will write for the highlighted event will run on the client.

Let’s put some code to illustrate another concept.

Okay, here is the code that lightswitch gives us for that particular screen. Notice that the highlighted event is BeforeDataInitialize, and the other event is Saved. With this, we can see that the code is a data event; or an event that happens on the data. What we don’t have here are all those UI related events and the code does not work with the view directly.

What this tells us, is that the application that Visual Studio Lightswitch gives you an application where there is a clear separation of concerns between the layers. I do think it follows or appears more like a MVVM approach than anything else.

What this tells you, is that VS LS leverages already proven architecture and patterns such as MVVM to create your application.

 

So there you go, that’s another peek under the hood of what a Visual Studio Lightswitch application is.

 

 

 

 

Advertisements
This entry was posted in Computers and Internet. Bookmark the permalink.

5 Responses to Lightswitch Demo Application

  1. Jenny Triñanes says:

    Nice, so this is what Lightswitch is all about!

  2. Doyle says:

    nice artice great blog 😀

  3. Doyle says:

    nice article great blog 😀

  4. Pingback: Implementing Access Control on a Visual Studio LightSwitch Application | Edu's "Techie" Blog

  5. Pingback: 5 Philippines MVPs Featured in MSDN and TechNet Flash Newsletters! « SEA MVPs Blog-A-Holic

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s