LightSwitch

First of all, WOW!

I had heard about LightSwitch, but I always got that same vibe as I am sure everyone else did – that it was a bit of a “toy”. I never really got into the whole Silverlight LOB thing, so I did not really think tweice about LightSwitch. Plus the whole sepearate download thing…

As Michael Washington said in an interview when asked if LightSwitch was a bit too basic for the “hard core” developer:

It’s in Visual Studio, so if you aren’t already a person who would open up Visual Studio it is not the product for you.

That pretty much puts things into perspective.

I needed a reporting solution, and I wanted something fast and simple. I know I cannot give a report builder to a marketing person and say, “have at it!” They won’t understand the db schema, and I would just wind up building the report myself. I decided it was the right time to give LightSwitch a go, and man am I impressed!

With Visual Studio 2012 Update 2, LightSwitch 3 was released. Included in LightSwitch 3 is the ability to create HTML5 clients. It is pretty darned awesome! LightSwitch makes getting started simple, but if you want to dive-deep you can. I was able to take our db and throw together a couple of sample reports in minutes. I even made a couple more while demoing LightSwitch for my peers – it is just drop-dead simple. However, don’t let the simplicity fool you – there are plenty of hooks to get in deep.

LightSwitch uses jQuery mobile, so it can use all the cool jQuery stuff out there. Wijmo is building LightSwitch-specific implementations of their widgets that should be in beta soon, but you could just use the current Wijmo widgets with a little elbow grease.

I am so stoked to get to using LightSwitch. I was dreading making these reports, but now I am actually excited. It will be so easy to make them that it will actually be fun. Whodathunkit?

Resources

EF and “dynamic” data

We use EF for our e-commerce website, and we have the need to get some data out in the form of reports. Ideally I’d like to be able to basically write up a report query and have the data come out on the other side. However, with EF it isn’t necessarily that simple.

I really don’t want to have to go through all the ceremony of creating models, mapping classes, services, etc. I’d like to keep it pretty simple with a service that can give me back the data I want, then I can use it in a Google Chart or a jQuery datatable or something on the client side. I want the server-side to be basic, and then I can focus on the client-side to give a rich report experience.

I did a quick search and came up with a couple of interesting options. The first is a way to dynamically query views. It sounds very interesting, but it looks like it isn’t quite what I am looking for. The post leaves things a little open-ended, but it looks like the views he is querying already have all the strongly-typed stuff needed and the code just performs dynamic queries against those static objects. I could be wrong though as there is not concrete example of how it is used, just the theory behind all the dynamic wackiness going on.

The next option looks a little more like what I am looking for – it returns a dynamic object using SqlQuery. The code in the post is a little verbose for my taste, but a commenter converted the code into an extension, and I like that idea a lot better. I put his code into a gist.

After looking into the options, I think that maybe the notion that I have to stick with EF is just holding me back. I am very familiar with Massive and have used it and enjoy using it. It is a single class file, and maybe it is just the thing I need to get this report data out of my database easily – which is the idea behind Massive!