Tag Archives: visual studio

Stop playing with the LightSwitch

25 Aug

If you’ll excuse me for a moment, I just got the sudden urge to totally geek out. Oh, who am I kidding? Here’s my latest techno-nerd-babble:

(FYI: It’s not a groove, it’s not slightly transformed, but it is a bit of a break from the norm.)

Yesterday I installed the new Visual Studio LightSwitch (Beta 1) app. After playing with some samples, I tried to create a simple app that calls an external web service and displays the data. I read somewhere that this isn’t possible unless you first call a WCF RIA Service, which could itself call the external service and send the result back to LightSwitch. Kind of like driving from Kansas City to St. Louis to get to Denver.

So, I added a WCF RIA Services project to the solution. To this project I added a service reference to a free web service I found which takes a given year and returns the date Black Friday took place that year. Delightful! And almost completely useless. But hey, it’s free.

I created a service method in my RIA service that simply calls the external service five times with five different dates. I wanted multiple results so I could return an IEnumerable<T> back to the UI. Next, I went through LightSwitch’s Add Data Source wizard and chose “WCF RIA Service”. After waiting an eternity (they take the word “Beta” very, very seriously at Microsoft), I was finally able to complete the wizard and add a reference to my RIA service.

Finally, I added a simple screen to display the data in a grid when the app loads. I hit F5 and…hey, it worked! That was both fun and educational. Maybe I’ll post screenshots if I get something interesting built with the production version of the tool. In the meantime, I better quit playing with the LightSwitch before I start a fire.

Right…like THAT’S really gonna happen, Dad.