Pixata Custom Controls
For Lightswitch

Recent Posts

Popular tags (# posts in brackets)

Anonymous types (3) ASP.NET (5) C# (3) C# tricks and tips (2) Computers (6) Design patterns (3) DomainDataSource (3) Dynamic data (4) Entity framework (3) Entity model framework (5) F# (3) LightSwitch (12) Linq (6) Microsoft (2) MVP (2) MVVM (2) Project Euler (2) RIA services (5) Silverlight (2) SQL Server (4) Unit testing (4) Visual Studio (7) WCF (3) WPF (3)

Gratuitous link to StackExchange




The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Actually, as I'm self-employed, I guess that means that any views I expressed here aren't my own. That's confusing!


Theme modified from one by Tom Watts
C#/F# code styling by Manoli (for posts pre-2016) and Google code prettify (for post from Jan 2016 and beyond)

My rambling thoughts on exploring the .NET framework and related technologies

Please note that this blog has ben retired. Most of the material has been migrated to my new blog at www.pixata.co.uk. Please update your bookmarks to point to the new blog.

Putting reality aside for a moment, and imagining that this blog has at least one avid reader, then he/she may remember that some time ago, I got all excited about ASP.NET Dynamic Data, which looked like a brilliant way to produce CRUD web sites (ideal for the admin back-end of most modern web sites) in almost no time at all. The same avid reader would no doubt also remember that I learnt quite quickly that it was a huge waste of time, great for management demos, but useless for the Real World, and gave up with it.

Well, another day, another new technology from Microsoft, and here we are with very similar promises about being able to produce CRUD web sites in minutes – introducing Microsoft Visual Studio LightSwitch. A moment’s pause over the name will probably reveal the pun on another Microsoft technology, SilverLight. LightSwitch is being promoted as the equivalent for SilverLight that Dynamic Data was for ASP.NET, in other words, a RAD development tool that allows you to produce CRUD sites very quickly.

So, why am I bothering? After all, my previous experience was, shall we say, less than positive! Couple of reasons I guess. First, I’m incurably inquisitive, and am always interested in looking at new technology, especially when it promises to save me time. Second, I’m just at the starting stage of a new web site, and it’s going to need an admin section. I have spent the past few weeks reading books on jQuery, as I was going to do the whole site (including the admin section) with AJAX. I have become quite excited by the possibilities that jQuery brings to the web developer, and was looking forward to using it.

However, even with the help of jQuery, or maybe because of it, as I’m relatively new to it, this admin section was going to take some time. So, when I saw some information on LightSwitch, my curiosity was piqued.

Cynical as ever, the first thing I did was to post a question in the LightSwitch forum, asking if it was another dead duck, or it was actually any good! I got some very interesting replies, many of which addressed my concerns over the way the application would be structured. It seems that Microsoft have finally realised that building a RAD tool that produces rubbish isn’t going to impress real developers, and may actually have implemented this one properly. I say “may have” because I haven’t got far enough into it to say for sure yet.

Despite LightSwitch still being in beta, and despite having to reinstall Visual Studio Service Pack 1 (which I wasted almost a whole day uninstalling recently after the mess it made of SQL Server Management Studio’s Intellisense), I decided to give it a go. This was partly because I have a new PC on order, so am not too worried if this one gets mucked up, and partly because I am, as mentioned above, terminally curious (ie, I love messing!).

My first impressions are that it is very fast and simple. They seem to have got a few things right this time, unlike Dynamic Data, where there wasn’t any attempt to check if it was safe to delete something, meaning that the unsuspecting user could click a “delete” link, and see a less-than-elegant unhandled exception! With LightSwitch, you simply don’t get the option to delete something like that. Small issue, but it really put me off Dynamic Data, as it showed a total lack of thought in the design process.

One really neat feature about LightSwitch is that you can create either a normal SilverLight web application that runs in a browser, or what they call an out-of-browser application, which looks rather like a standard Windows desktop application, but it actually doing all the 3-tier stuff for you. You can flip between the two with a single setting in your project properties. I like that!

One downside to LightSwitch is that version 1 doesn’t allow any unit testing. Huh? I thought you said they had got it right this time? OK, so this is quite a serious omission, and initially put me off completely, but someone pointed out in a forum post that it’s pretty easy to move your own code out into a separate project, which can be tested as usual. I haven’t tried this yet, but if LightSwitch applications really are built on MVVM, as it seems, and if it really is easy to move your code out, then testing becomes easy. As I said, I haven’t tried this yet, so will reserve comment until I do. In all fairness though, as most of the coding is done for you, and all the boring plumbing comes for free, you don’t actually need to do a lot of the testing that would otherwise be necessary, as it’s built into the LightSwitch framework.

Anyway, I’ll stop waffling here, and reserve more comment for when I’ve (hopefully) had more time to play with it. Watch this space!

Comments are closed.