Chapter 1. Introduction

The important thing to point out right from the start is that Visual Studio LightSwitch in its stand-alone version shares much of the same functionality as the full version of Visual Studio. Figure 1-1 shows the opening screen of Visual Studio LightSwitch, which looks just like what you would see if you launched the full version. There are differences, however, in many ways. Visual Studio LightSwitch uses a model-based approach to building applications and a declarative method of creating screens. That means you won’t have the familiar drag-and-drop design surface for your screens you’d expect with a typical C# or VB.NET Windows application.

Many of the same menus, like the Server Explorer, are still available but are hidden by default. Other menus, like the toolbox with various screen elements, are not there in the stand-alone version. You will be able to debug your applications by using the normal process of setting breakpoints, examining variables, and single-stepping through your code. The only hitch here is you have to write code to actually debug it. In some cases, it’s helpful to put in a debug line in a routine you know will run just to poke around and see what variables are used.

If you do start poking around underneath the covers of the Microsoft code created for every LightSwitch app, you’ll quickly find out that there’s a lot of code there. It’s probably best that you not change any of the automatically generated code unless you want to break something. There are plenty of places to add your own custom changes without modifying the default code. You’ll see this a little later on when I introduce you to the different designers.

Initial LightSwitch screen

Figure 1-1. Initial LightSwitch screen

Basic Concepts and Terms

Visual Studio LightSwitch uses the classic three-tier architecture approach to building applications consisting of Presentation, Logic, and Storage. If you look under the covers of the Presentation level, you’ll find Silverlight 4.0 as the underlying technology. This is what makes it possible to target your applications at both the desktop and a web browser. It also limits you somewhat to building your user interface (UI) on top of the Silverlight toolkit.

The Logic tier utilizes Windows Communication Foundation (WCF) Rich Internet Application (RIA) Services on top of ASP.NET 4.0. These services can be hosted locally on a client machine, on a server running IIS 7, or in the cloud via a Windows Azure Web Role. Primary Storage utilizes Microsoft SQL Server or SQL Azure. Stand-alone apps require Microsoft SQL Server Express 2008.

Visual Studio LightSwitch borrows a great deal from the Entity Framework for its data model. All LightSwitch data services use an Entity Framework ObjectContext as the primary way of communicating with the data tier. All LightSwitch applications also use the Model, View, View-Model (MVVM) pattern. MVVM is a Windows Presentation Foundation (WPF) design pattern that has gained a significant following since its introduction. The key rationale for MVVM is the separation of functionality between the View, or UI code; the code underneath or behind the View (View-Model); and the code that interfaces to the data or model.

Get SharePoint Apps with LightSwitch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.