Dave Noderer's Blog

August 2010 Entries

My 1st Lightswitch App

On Tuesday August 18th, the first publicly available beta for the Microsoft Lightswitch development tool was posted on MSDN.

For more information about this Silverlight application generator addition to Visual Studio 2010 visit: http://msdn.microsoft.com/en-us/lightswitch/default.aspx

Because it is still a beta I installed the 500mb ISO on a Windows 7 virtual pc VM which already had Visual Studio 2010. I had not spun up this VM for over 4 months so there were LOTS of updates to apply first. Although some have reported problems, mine went smoothly.

The default 512mb memory on the VM was not enough. Understandably it was very slow and when I first tried to run the generated program it timed out. So I increased the VM to 2gig and it ran much better!

For consultant time keeping, I’ve been using a classic asp website and access admin program for over 10 years. I could never justify making a change (nobody is paying for it).

I created a new Lightswitch project, both VB and C# are available:

image

I created a new datasource pointing to a SQL 2k5 server (2k5 or above is required) at my web host (http://www.Appliedi.net) where the Computer Ways timesheet data resides. Knowing that Lightswitch is based on Entity Framework and also that I’ve been meaning to do it, I added foreign key relationships on the main tables I would need. In the past this was enforced by the application originally on Access then SQL 7.

This process of adding a datasource is easy and familiar. It starts the datasource wizard:

image 

and ending up in the table / view selections for Entity Framework:

image 

Next I added a new “Screen” which brought up the data model, defaulting to Consultant but I switched to default of TimeSheetDetail by double clicking on it. This switched the view to what you see below by using the navigation on the objects which in turn is based on the foreign keys.

image

From here I could click on screen and decide on a format to display the data. I selected editable grid:

image

Running the project (no code at all so far), the program comes right up

image

I was able to actually add some hours for the day. Baked in is the relationships so selecting a consultant, for example, brings up this screen:

image

For many corporate and personal applications, this will be a great help. Unlike Access, this is .net in Visual Studio with a number of extension points.

This default screen can be customized in many ways, here is the “Customize Screen” view:

image

I have not deployed this but you get the option of web or client (it is Silverlight).

I’ll definitely expand on this over time and can see lots of applications.

C# 4.0 How-To – Book Review

I recently read the book “C# 4.0” How-To by Ben Watson, published by SAMS, ISBN-13: 978-0-672-33063-6.

I’m a primarily VB.net developer (hey I”m a VB MVP) but these days I find myself using C# more and more.

This is a practical book; seeing exactly how to code various patterns in C# was very useful.

The usefulness was three fold.

First, as C# is not my 1st language, sometimes I stumble a bit when trying to express some code in C#. There are many many examples of using a very wide range of classes that makes it easy to find a relevant case.

The second useful thing was just seeing a number of patterns programmed that I have not used myself. One area is implementing interfaces. It is a common practice in .net but there are lots of interfaces in the .net framework which I rarely touch. I liked the example of implementing a generic interface.

The third thing is seeing details of many .net class overloads expanded out in written form.  Although Visual Studio intellisense is very good, I must admit that even some of the string and numeric methods have overloads or options that I was not aware of.

I’m going to keep this one on my shelf for a while. I can see it as being very helpful when refactoring a troublesome piece of code!

Microsoft Lightswitch announced…

After a few years of development, Microsoft has finally announced Lightswitch. This was formally a very hush hush project code named Kitty Hawk that even the MVP’s only had very limited knowledge of.

You can get more information at: http://www.microsoft.com/visualstudio/en-us/lightswitch and it will be generally available in Beta form on August 23rd.

This tool is an add-on to Visual Studio 2010 that allows a power business user (or developer) to very quickly generate a data centric application then make it into a client or web based application.

The resulting program is basically a Silverlight application.

Being all .net it is fully extendable in a number of ways but it will take a while for all those details to come out and I’m sure will change over the first few releases. One example is that Infragistics will have “skins” for it.

Jason Zander does a walkthrough on his blog at: http://blogs.msdn.com/b/jasonz/archive/2010/08/03/introducing-microsoft-visual-studio-lightswitch.aspx

Time will tell but I for one am excited to see the entry level programming made so much easier. People have compared this with Access which drove (and still does) many thousands of businesses but many of these “applications” had serious problems in the way they were structured and used. A vocal contingent “users” will create monstrosities with Lightswtich and then dump it on the professional programmers to straighten out as was the case with Access.

While there is some truth to this, and I created or touched hundreds of Access programs myself, I think the net result of making tools accessible to non-programmers is a very good thing. At least it forced the potential customer to think through what data they need and what screens they require in a way that is not possible without actually having a proto-type. The problem, as always, is when the proto-type turns into wide scale production.

In any case I’m in for the ride!