NOTE: If you are looking for the updated Visual Studio 2012 version see: Contoso Construction - LightSwitch Advanced Sample (Visual Studio 2012)
This sample demonstrates some of the more advanced code, screen, and data customizations you can do with Visual Studio LightSwitch as a professional developer. If you are not a professional developer or do not have any experience with LightSwitch, please see the Getting Started section of the LightSwitch Developer Center for step-by-step walkthroughs and How-to videos. Please make sure you read the setup instructions below.
Features of this sample include:
I demonstrated this sample at TechEd and showed different levels of customization that you can do to your LightSwitch applications as a professional developer by putting your own code into the client and server tiers.
Watch my session from TechEd: Extending Microsoft Visual Studio LightSwitch Applications
During the session we built some of the parts of the application that any LightSwitch developer has access to. You don’t necessarily need VS Pro to write advanced LightSwitch code. We dove into the LightSwitch API, explained the save pipeline and the DataWorkSpace as well as talked a little bit about the underlying n-tier architecture upon which LightSwitch applications are built. I showed how to access the code behind queries so you can write more advanced LINQ statements. I showed how to flip to File View and access client and server projects in order to add your own classes. We injected some business rules into the save pipeline in order to email new, updated and canceled appointments and I walked through how to use content controls in Word to create report templates that display one-to-many sets of data. I also showed how to build custom Silverlight controls and use them on screens.
You will need Visual Studio LightSwitch installed to run this sample. Before building the sample you will need to set up a few things so that all the pieces work. Once you complete the following steps, press F5 to run the application in debug mode.
These are .VSIX packages and are also located in the root folder of this sample. Close Visual Studio and then double-click them to install.
In order to use the Bing Maps Control and the Bing Maps Web Services, you need a Bing Maps Key. Getting the key is a free and straightforward process you can complete by following these steps:
When you create, update or cancel an appointment in the system between a customer and an employee emails can be sent. In order for the emailing of appointments to work you must add the correct settings for your SMTP server in the ServerGenerated project's Web.config:
<add key="SMTPServer" value="smtp.mydomain.com" />
<add key="SMTPPort" value="25" />
<add key="SMTPUserId" value="admin" />
<add key="SMTPPassword" value="password" />
The system is set to Forms Authentication but if you change it to Windows Authenticaion then in order for the "My Appointments" feature to work you will need to add yourself into the Employees table and specify your domain name as the user name. Make sure to specify a valid email address if you want to email appointments.
In order to import data on the Materials Catalog screen, copy the StructuralMaterials.xls located in the root of this sample to your My Documents folder first. Then click the Import from Excel button on the screen and select the spreadsheet. You can them map the columns in the spreadsheet to the entity properties and the data from the spreadsheet will appear as new rows on the Materials Catalog. Click Save to send the data to the database.
You can get a good understanding of more advanced LightSwitch features by working through the LightSwitch Training Kit. If you look under the “LightSwitch Advanced features” section on the right-hand sidebar on the opening page of the kit you will see the demos and labs.
Here are some more resources of Visual Studio LightSwitch to explore: