This chapter begins with explanations as to what makes this software so important and places it in the context of the Visual Studio suite of products. This chapter also aims to help the reader install the required items on the user's computer. It also deals with installing the necessary sample database or databases that will be used together with the LightSwitch applications, as well as other infrastructural details.
Topics to be covered:
What is Visual Studio LightSwitch and who is the target audience?
Installing Microsoft LightSwitch
Installing the databases used in the book
After this chapter, the reader would have a basic understanding of what this software is about, how to install the software, and how to install the necessary database(s) to work with the software.
Microsoft Visual Studio LightSwitch (will be called VSLS from here on) is the most recent offering in the Visual Studio suite of products that provides a fast and easy means to create professional-quality line-of-business applications for the three important application genres: the desktop, web, and cloud. However, it is to be noted that in Beta 1, hosting the LightSwitch application on Windows Azure was not supported and in Beta 2, it is supported.
There has been some debate as to the target audience for this product, but from the developments that the product has undergone from Beta 1 to Beta 2, it is easy to see that it should appeal to a larger group than was initially intended. The extension points and the fact that VSLS applications can be deployed to Windows Azure will now appeal to a larger group than was initially envisaged. It should appeal to small businesses that have minimal developer support to bigger departmental applications; to software vendors that would build upon VSLS's core capabilities using its extensibility features; to businesses that may want to migrate their legacy Microsoft Access-based applications to the Cloud. With future enhancements to the product, it may even be possible to move Visual FoxPro applications.
VSLS takes off where Microsoft Access left off. Microsoft's MS Access program became a workhorse for many small businesses and for developing departmental applications in larger businesses, and remained a favorite of these communities for a very long time. This enormous appeal was due to the fact that the program could readily adopt to line-of-business applications with its easy-to-understand object model, support for graphic user interface, support for user management, integration with SQL Servers, support for various export/import tools, and finally its ability to create web-facing applications with Data Access Pages. Yet, Microsoft Access, being file-based, always had security-related issues, as well as a limit on the number of connected users issues. It was not intended for web facing applications, though DAC improved this situation. With the beginning of SharePoint products, Microsoft abandoned its support for DAC.
VSLS may be deemed a much more powerful product due to its capability of creating applications by drawing upon the full power of the .NET Programming technology, its tight integration with SQL Servers including the latest implementation of SQL Server for the Microsoft Azure Cloud platform (the SQL Azure), its most recent framework (SilverLight 4.0) support, and its built-in capability to deploy applications to many different topologies. In fact, this was the first time a single application could be built once and deployed to different topologies. In the past, it was either for Windows or the Web, but not for both. Little did the author suspect that the "out-of-browser" execution of the Silverlight application would have such profound implications (http://aspalliance.com/1844_DoubleAnimation_Basics_with_Silverlight_Application).
Microsoft LightSwitch Version 1.0 is expected to be released by the end of 2011, but is guaranteed to be compatible with SilverLight 4.0 (http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/db9c4f49-8e43-40a2-93bc-40b597e8a5df).
The line-of-business abstraction is taken to a level where the user needs to be concerned only with data sources and the "screens" that a business is most likely to be concerned with, as the "screens" in the application, represent the patterns common to most of the applications such as search, update, insert, and so on. Most other programs design applications with much more complexity, and much less flexibility and security. VSLS actually leveraged and abstracted the common patterns in business applications. While the Betas provide one such pattern through their default screens; developers and third parties can build custom screens to address their line of business.
VSLS in its release version will be a full-service Integrated Development Environment (IDE), well suited to develop line-of-business applications using Microsoft's latest .NET Framework 4.0 technology.
Unlike the other products in the suite, such as Visual Studio Professional and higher versions, Microsoft LightSwitch is targeted at developers and first-time users with limited exposure to Visual Studio programming models, and the plethora of application types that can be handled with Visual Studio. Microsoft LightSwitch is really for those who want to develop applications quickly and easily, without writing even a line of code. However, if a user needs customization, he or she may yet have to write an additional code, and the original assertion that no code needs to be written maybe bit of a stretch. In order to support custom programming, VSLS does support writing code by providing support to many events that are natural in any application. In addition, one can custom program using the extensive library that can be referenced. Extensions further provide for features built by more experienced developers or third-party vendors. For these and other custom code, Microsoft LightSwitch alone is not enough. It will require at least Visual Studio Professional in Beta2. However in the release version, VSLS may completely cover all aspects of programmability without needing to install higher versions of Visual Studio.
Microsoft LightSwitch can cover the whole spectrum of developers from novices to experts. Already since its release, many such programs have been written by advanced developers as seen in the forums (http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/threads) and programs developed by third parties (http://blogs.infragistics.com/blogs/jason_beres/archive/2010/08/05/infragistics-microsoft-lightswitch-awesome.aspx).
You can purchase Microsoft LightSwitch 2011 from:
http://www.microsoft.com/visualstudio/en-us/lightswitch/buy. There are three different purchase options. A single user can buy it for $199 and save $100 . Beta 1 and Beta 2 versions are available free of cost.
What is VSLS and how does it work? Microsoft LightSwitch is model-centric rather than driven by code. The application model is at the heart of a Microsoft LightSwitch application. The application model is built using the application blocks. Entities are built from EntityTypes and queries derive from entities. Screens consist of controls. The built-in designers use these blocks to create the application; picking entities and binding them with the desired screens. The run time gets this model moving by loading the application, retrieving the data, overseeing and running the logic that binds the screens with data, and a host of other activities.
It is the built-in designers that give the flexibility to the application developers in choosing data, and tailoring their displays and user interface. The designers work with the blocks described in this section.
As mentioned earlier, VSLS is specifically meant for line-of-business applications and EntityType is its basic unit. For example, as shown in the next screenshot, Customer described by its various constituents, is an example of Entity Type, and so is Order. The Customer has a Key Property as well in relation to the other entity Order; it has a Navigational Property shown by the line joining the two. Additionally, although not shown explicitly in the screenshot, there is also a Computed Property that you see as one of its menu items. It is not mandatory for an entity to have navigational or computed properties. The data source NorthwindData is a container of these entities. The entity designer is where you define a new entity or bring one by attaching it to the data from an external source.
The query designer shown in the next screenshot is where you design a query after choosing an entity on which it is based. A query based on another query is also allowed. A query has the same data as in an entity, but only some selected version of it. That is, it has the data that is filtered and sorted based on some criteria that you can set in the designer.
The Screen designer shown in the next screenshot is where a screen is designed. The IDE binds the data to the screen when you bind the entity to the screen to expose the entity to a user. These screens are pre-built to address common business scenarios, but with extensions it will be possible to build custom screens. However, one can start with an unbound screen (shown in the next screenshot) and bring in entity data or query data to the screen using hooks (Add Data Item…) in the Screen designer.
If you become conversant with using these designers, then you will be able to build applications effortlessly, as the screens, the queries, and the entities are tightly bound by the IDE.
After designing the application in the IDE, it is the run time that executes the program to achieve the design objectives and display results to the user. The run time is based on many other Microsoft technologies, such as Model View ViewModel (MVVM), SilverLight, WCF Data Services, and so on, that utilize the best practices to provide a secure and extensible application which can be hosted on both the desktop and Web; a hitherto unavailable feat in a single application. A user can indeed work with the IDE to create applications without a full understanding of the behind-the-scene workings of these sophisticated technologies. However, to create something that is not built-in, it will be necessary to have an understanding of the above technologies to some extent.
Applications can be written without a line of code just by using the built-in features. However, run time can also draw upon the Application Programming Interfaces (APIs) to write code against events that an application would raise, such as an entity getting updated, a screen element getting displayed, or a validation being checked, and so on. The extensibility points available in the IDE provides for more advanced customization.
In the next section, the preliminary tasks necessary for working through the rest of the book will be described.
Microsoft LightSwitch program
vs_vslsweb.exe (3.3MB, version Beta 2, Date Published: 3/7/2011) may be downloaded from the location: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=CFF6C4EF-A29A-4C82-9A59-8A3BBB65EC3D and saved to a location of your choice. The saved file can be used to install the program later.
The following are the system requirements:
Supported Operating Systems: Windows 7; Windows Server 2003 R2 (32-Bit x86) or above, Windows Server 2003 R2 x64 editions, Windows Server 2003 Service Pack 1 or above, Windows Server 2008, Windows Vista, Windows XP Service Pack 2 or above.
x64 (Windows 32 on Windows 64 bit)
The following are the hardware requirements:
This book was developed using the (x32) Windows 7 Ultimate OS on an ASPIRE notebook computer.
Describing the installation of the product will be limited to Windows 7 and Windows XP, although it can be installed on many more operating systems both x32 and x64. As some of the would-be users (non-programmer, hobbyist, junior developer, and so on) will be using either Windows XP or Windows 7, installing on these OSs will be described in the following sections.
Download the Microsoft VSLS from the link mentioned earlier: (http://www.microsoft.com/visualstudio/en-us/lightswitch).
You can either purchase a single individual user's or developer's copy or download a trial version from: http://www.microsoft.com/visualstudio/en-us/lightswitch/try
Double-click on the executable
vs_vslsweb.exein the download location shown in the next screenshot:
This displays the Welcome to Setup page of Microsoft Visual Studio LightSwitch Beta Edition Setup window, as shown in the next screenshot:
Read the EULA before you click on Install Now.
The installation starts downloading the needed files that may vary depending on the computer on which they are installed. The VSLS server software is downloaded as shown in the next screenshot:
These are the only components that are downloaded assuming you have Silverlight 4.0 on your computer and the other components (http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/7ca9ddf6-27da-487d-8383-d8dad3a612ca). If Silverlight 4.0 is not installed, the above installation will install Silverlight 4.0.
If you have an older build of Silverlight 4.0 Visual Studio LightSwitch, install a newer version of Silverlight - 4.0.50630.0. This could be an issue with some Silverlight projects that you did before. It is recommended to download the latest public build of Silverlight 4: 4.0.50917.0. You can find it here: Silverlight Tools 4 (http://go.microsoft.com/fwlink/?LinkID=177428 and Silverlight Runtime: http://go.microsoft.com/fwlink/?LinkID=149156).
Click on Close after the download is complete.
This starts the installation and at its conclusion you will get the window shown in the next screenshot. Now you are ready to start using VSLS. This whole process took less than half an hour on the computer used.
It may not be possible to describe all problems and their remedies, but some of them encountered while developing the material for this book will be described. The VSLS team has come up with a comprehensive list of the components that should be present for successful installation: problems and fixes (http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/7ca9ddf6-27da-487d-8383-d8dad3a612ca). You may experience varying degrees of difficulty, especially if you have the beta and CTP versions of some Microsoft programs. In one of the earlier installations on this computer, when one of the components was absent, installation did not succeed till the required component was installed. For details, review the link: http://hodentek.blogspot.com/search?updated-max=2010-08-29T20%3A29%3A00-07%3A00.
In case you are unable to install for some reason, you should take a look at the installation log files:
dd_error_vs_vslscore_100.txt to identify where your installation might have gone wrong. To find this and related files, go to the
Logs sub-folder in the installation folder:
\Microsoft Visual Studio LightSwitch Beta Edition – ENU\Logs. Some of these files could run to a couple of thousand pages. If there are no errors, the error file will be empty.
While this section describes the installation of Beta 2 on Windows XP, the information will still be useful for installing Microsoft LightSwitch 2011. You will still need Windows (x32) SP with SP3. Review the link at: http://www.microsoft.com/visualstudio/en-us/lightswitch/overview/system-requirements for more information.
Installing on Windows XP is no different from installing on Windows 7, except that you need to note the following, and in case you find these indicated programs on your computer, do what is required, as indicated.
Please note that:
At a minimum, you should have Windows XP with (Service Pack) SP 2.
On the computer used for this book, SP3 was installed.
Beta of WCF RIA Services, if present, should be removed.
Beta 2 of MS .NET Framework 4 client, if present, should be removed.
Also note that before you remove Beta 2 of MS .NET Framework 4 client, you should remove .NET framework 4 extended Beta 2, if you have it. These betas were removed from the author's computer before installing LightSwitch.
It is preferable to have SQL Server 2008 Express (or higher up to SQL Server 2008 R2 Enterprise), as well as the recently released free edition, the SQL Server Express 2008 R2 (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=967225eb-207b-4950-91df-eeb5f35a80ee&displaylang=en) on the computer, as it is used by VSLS applications. According to the answer found in the forum (http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/549c7dd9-0919-473d-a841-81dbc53f23c5), VSLS installation should install SQL Server 2008 Express, if it is not already present. It is assumed you have the necessary .NET Framework (.NET 3.5) to install SQL Server 2008 Express 2008. On the author's computer, SQL Server 2008 Express was already present. In addition, Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (Intel X86) Enterprise evaluation edition was also present.
In case SQL Server is not installed for any reason, the following link describes the three flavors of SQL Express that you can install on your computer and the links to their download sites:
All you need to do is to double-click on the
vs_vslsweb.exe file to start the download and installation process.
Follow the installation wizard instructions and the wizard steps may not be the same as in the case of Windows 7, as the installed programs on Windows XP SP 3 may be different from those on Windows 7. For example, the installation displayed the next screenshot when the download and installation process started:
This download will continue until all the following items are downloaded and installed on the computer:
VC 9 and VC10 runtime (x86 or x64)
MS .NET F 4.0
MS .Net Framework 4.0 Multi-targeting pack
SQL Server 2008 R2 Management Objects
MS Help Viewer 1.0
TFS Object Model (x86)
MSWeb deployment tool (x86)
Silverlight 4 SDK
WCF RIA Services
Microsoft Visual Studio LightSwitch Beta Server
Microsoft Visual Studio LightSwitch Beta Edition
The installer verifies the already-installed components and installs the programs that are not present on the computer. For a comprehensive list of programs installed, follow this link: http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/7ca9ddf6-27da-487d-8383-d8dad3a612ca. It has a list of most of the installation-related troubleshooting information as well.
After downloading and installing the files, Visual Studio LightSwitch Beta 2 will be installed without any problem, although the whole process takes nearly two hours (with an average download speed of 185 kbps on the Wi-Fi connection, compared to under half an hour on Windows 7).
As the book will be using Northwind and Adventure Works databases whenever a database on the SQL Server 2008 Express is used, these databases will be required to work with the book. The following section describes where to obtain the sample databases, as well as bringing them to the SQL Server 2008 Express installed on the computer. By default, the server installation does not contain sample databases.
Download the SQL Server 2000 Sample DBS, as well as Microsoft Sample Databases from the CodePlex site:
Download SQL Server 2000 databases Northwind and Pubs from:
The installation of databases on SQL Server 2008 requires attaching the database MDF and LDF files to the server. This process is described in the following blog: http://hodentekmsss.blogspot.com/2010/05/using-sample-databases-with-sql-server.html, where an Adventure Works database is installed on an instance of SQL Server 2008 R2.
However, with the sample files download from http://code.msdn.microsoft.com/northwind, which provides a ZIP file, the process is even simpler if you follow these indicated steps:
zip, a 1.2MB file from:
Extract the files from the ZIP to a location of your choice.
Connect to the SQL Server Express in the Microsoft SQL Server Management Studio.
Right-click on the databases node and choose Create a new database.
Create a new database Northwind in SQL Server 2008 Express.
Expand the Database node and right-click on the master database node and choose New Query.
In the Management Studio's menu, click on File | Open | File...; browse and locate the
instnwnd.sql scriptfile mentioned earlier.
The installation script gets copied to the query window.
Do a syntax check and execute the query by clicking on the Menu icon.
The script is executed very quickly and you have the Northwind database in SQL Server 2008 Express.
After the query is run, you must be able to find the Northwind database in your SQL Server 2008 Express as shown:
The chapter describes some of the basic architectural features of VSLS for designing VSLS applications. Features that differentiate this product from other programs are also described. After describing the hardware and software requirements for installing VSLS, the download and install process is described for both Windows 7 and Windows XP. Downloading and installing the sample databases, which are used with this software, is also described.
Here are some of the resources that will help in your understanding of VSLS Applications:
Microsoft LightSwitch site at:
Microsoft Documentation of Microsoft LightSwitch is found at:
About a dozen videos describing VSLS Applications on MSDN are at:
Video introducing VSLS can be found at: