Recently I spoke at DevDays 2011 in The Hauge, Netherlands, and what a show! It’s my second time speaking here at the World Forum – a great venue that holds a few thousand people. This is a professional developer and IT Pro conference that they put on every spring. I did 3 sessions and 1 “geek night” talk all on Visual Studio LightSwitch so I came up with some new content and demos that I think people enjoyed.
Introducing Visual Studio LightSwitch
This session was in a huge theater that had maybe 400-500 people. It was awesome to see such an interest in this new member of the Visual Studio family. In this session we build my version of the Vision Clinic application from scratch, end-to-end, including security and deployment. We do write some code but only some simple business rules and calculated fields, and in the end we have a full-blown business application. The goal is to show what LightSwitch can do for you out of the box without having to know any details of the underlying .NET technologies upon which it is built. I did the entire demo with just Visual Studio LightSwitch installed (not VS Pro or Ultimate) so that I could show how simplified the menus, toolbars, and tool windows are inside the development environment. The recording is available on Channel 9. I suggest downloading the High Quality WMV:
When I asked who had downloaded the Beta already, only about 10% raised their hand so I made it my job to convince everyone to go download it afterwards ;-). I also asked how many people were not professional developers (didn’t get paid to write code) and a few people raised their hand (I expected only a few since this was a pro developer conference). Those few were IT pros and business people that came to listen in and one business person followed me to my next talks because of how excited he was in the prospect of using LightSwitch for his cloud consulting business.
What I showed in the session is pretty much exactly what I included in the LightSwitch Training Kit. If you look under the “LightSwitch Overview” on the right-hand sidebar on the opening page of the kit you will see the complete demo code and demo script that you can use for training folks at your local user groups. Here are some more resources to check out that will help introduce you to Visual Studio LightSwitch:
- LightSwitch Developer Center & Learning Center
- LightSwitch Training Kit
- LightSwitch How Do I Videos
- LightSwitch Samples
- LightSwitch Team Blog
- LightSwitch Forums
Visual Studio LightSwitch – Beyond the Basics
This session drew about 100 or so attendees, and everyone but a couple people had either been to the intro session or already knew what LightSwitch was. In this talk I show what you can do with LightSwitch beyond just the screen templates and entity designer.
I started off by quickly walking through the Course Manager sample which shows off features of Beta 2. This application does not have any custom controls or extensions and really shows what kind of powerful applications you can build right out of the box with just Visual Studio LightSwitch installed. Check out the series Andy has started on how he built the Course Manager.
We then dove into the LightSwitch API and I 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 also showed how to build custom controls and data sources as well as use extensions. In this session I had LightSwitch installed into Visual Studio Professional so that I could show building custom controls. You create custom controls like you would any other Silverlight control in a Silverlight class library which can be referenced and used on screens. If you want to go a step further you can create a LightSwitch extension which (depending on the type of extension) integrates into the LightSwitch development environment and shows up like other built-in items.
To demonstrate custom controls, I built a simple Silverlight class library with a custom list box of my own and then showed how you can set up the data binding to the view model and reference the control on your LightSwitch screen. I also built a custom RIA service and showed how LightSwitch screens interacted with custom data sources. When I got to extensions, I used the Bing map control extension (which is included in the Training Kit) and loaded it into LightSwitch. Just like any other Visual Studio extension, LightSwitch extensions are also VSIX packages you just click on to install. I then added the map to a Patient details screen to display the address of the patient.
LightSwitch Advanced Development and Customization Techniques
In this session I showed some more advanced development and different levels of customization that you can do to your LightSwitch applications. There were about 50 people in the session and I recognized some of them as MVPs and other speakers. This isn’t surprising since the product is still in Beta, I was happy to see 50 people there ready to dive deeper.
I started off by showing an application called “Contoso Construction” that I built using Visual Studio LightSwitch edition (no VS Pro installed) that has some pretty advanced features like:
- “Home screen” with static images and text similar to the Course Manager sample
- Personalization with My Appointments displayed on log in
- “Show Map..” links under the addresses in data grids
- Picture editors
- Reporting via COM interop to Word
- Import data from Excel using the Excel Importer Extension
- Composite LINQ queries to retrieve/aggregate data
- Custom report filter using the Advanced Filter Control
- Emailing appointments via SMTP using iCal format in response to events on the save pipeline
(I PROMICE I will get this sample uploaded but we want to use it at TechEd next week so I was asked to wait a week.)
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, you just need it to build extensions (which we did in the end). I showed how to access the code behind queries so you can write more advanced LINQ statements (and I messed up one of them too – my only demo hiccup of the conference so not so bad!) I showed some advanced layout techniques for screens and how to place static images and text on screens. I also 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 then went through the 6 LightSwitch extensibility points. Shells, themes, screen templates, business types, custom controls and custom data sources. I showed how to install and enable them and then we built a theme. I showed off the LightSwitch Extension Development Kit which is currently in development here. This will help LightSwitch extension developers build extensions quickly and easily and I used it to build a theme for the Contoso Construction application. Just like I mentioned before, LightSwitch extensions are similar to other Visual Studio extensions, they are also VSIX packages you just click on to install and manage via the Extension Manager in Visual Studio (also included in LightSwitch). For a couple good examples of extensions, that include all source code see:
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 advanced resources of Visual Studio LightSwitch to explore:
- LightSwitch Beta 2 Extensibility “Cookbook”
- The Anatomy of a LightSwitch Application
- Walkthrough of a Real-World LightSwitch Application used at Microsoft
- Channel 9 Interview: Inside LightSwitch
One of our ASP.NET MVPs and LightSwitch community champions, Stefan Kamphuis held down the fort at the Visual Studio LightSwitch booth. He said it was packed the entire conference. I stopped by a couple hours and there were a lot of great discussions around how LightSwitch works, how does it scale, and deployment options. I also found it cool that everyone that came by on my watch had backgrounds in VB6, Access, Cobol and/or FoxPro and struggled with the move to .NET in the beginning for these types of business applications (myself included).
My geek night session was titled “Build a Business Application in 15 minutes” but the session was 45 minutes long and no one brought beer. So I started asking people what king of bells and whistles we should add to the app. I screen scraped the session and speakers lists from the DevDays website and then used the Excel Import extension to upload the data into the system. The cool thing about this control is that it will also relate data entities together for you, so I had a list of speakers and their sessions. I then added a rating control from the Silverlight Toolkit and adapted it to use it in LightSwitch to give speaker ratings. I think people enjoyed it even though I didn’t have beer.
I stayed thru Saturday for Queensday and OMG what a party. I’ve never seen so many people dancing on the streets nor that much trash in my life. What an unforgettable experience. I had an absolute blast!
Thank you Netherlands, see you next time!