When Written: Aug 2010
I watched a video the other day about a new web development tool which made my jaw drop. Although the video was nearly an hour long I watched it twice to make sure I was seeing it correctly. Its name? LightSwitch (http://www.microsoft.com/visualstudio/en-us/lightswitch ). It creates Silverlight apps, geddit? I then downloaded it to my poor over stressed main machine to have a play, and in about five minutes I had built some basic admin screens for one of our database driven web applications.
Now whilst there are lots of products that will do something similar, not one that I have seen works quite like this. Most of them are wizard based products that ask you a series of questions and will ‘squirt out’ some code for you. LightSwitch is so different to this, it being a graphical design tool that gives you the flexibility to test and refine your design. You can edit and change anything you like as well as adding raw code and building or loading extensions, after which your application will rebuild to reflect these changes. All the code for adding, deleting, editing, and searching records in a database is created for you, whist maintaining any relationships and implementing the deletion of child records if a parent record is removed.
LightSwitch creates Silverlight applications in a few clicks
When you run your application in LightSwitch it produces a Silverlight application that will run either in the browser or on the desktop as a ‘normal’ application. The quality of the application is impressive, even more so when you realise that this is first Beta which, by the time you read this it should have become public. I found out about this beta through some idle browsing which I call research although my friends call it playing – quite what Microsoft PR is doing these days I and several of my colleagues have no idea as we seem to get little if any information from them nowadays.
After downloading and installing LightSwitch you initially find nothing new on your machine, it is only when you open Visual Studio 2010 that you see two extra options when creating projects; these are LightSwitch VB and C#. Which one you choose only depends on whether you intend to add your own code to the application, in which case choose which ever language you are most familiar with, there are apparently no differences with what you can achieve in either.
The first screen that you are presented with asks you either to point to an existing database and select the tables, or create a new one. When creating a new table the data type choices for the fields are interesting as there are the usual items like string or numeric data types but also some new ones such as email or telephone, if you select this then your application will know to do data validation based on these types and so for example an email field must contain a ‘@’ in it. Select a date time field and when an edit field is on a screen, beside it will be a calendar type date picker with a drop down time picker. All this data validation is achieved without you writing any code.
Once this is done you next select a screen type for a particular table. Currently there is a choice between create new, search item, details, editable grid and a screen with list and details type of view for those one-to-many type of record relationships that often need displaying, For example you might have a database table with customer accounts as the list part and a database table showing the orders they have placed as the details part. These screens are of course fully customisable, the video hinted and showed how a different ‘skin’ could be applied to completely change the look of an application created in this way, although I suspect that currently the methods to achieve this are quite complicated and best left to the Microsoft developers for now. More screens will no doubt be added in the near future, but for now these will enable you to achieve most things.
When the time comes that you need to write some code for something unique to your application then the full debugging capabilities of Visual Studio 2010 are available to you, with intellisense. The full name of the product is currently Visual Studio LightSwitch and although it will not be free, it will apparently be one of the cheaper offerings of Visual Studio if rumours are to be believed. The current release is first beta and so the standard rule applies of ‘if it worked perfectly it would be shipping’. If this product is allowed the resources to develop in the way it should be then we could end up with a simply stunning design tool, particularly for the creating of those boring admin pages that we all have to write. I will be watching this space closely.
Article by: Mark Newton
Published in: Mark Newton