Rumor has it… LightSwitch HMTL Client preview 2 is released – omg omg omg with a ServerApplicationContext?!?

Testing… 1… 2… Is this thing on?  Man it’s been a while since I blogged, hopefully I still have that fingerspitzegefühl…

Hey LightSwitch lovers out there!  It has indeed been a while since I blogged or actively participated in the community, and this is because I’ve been really unfortunate with my health and energy levels the last couple of months.  I’m gradually getting better though, and taking back control of my life.

And of course, as you can imagine, LightSwitch is still a major part of my life, as is my Hacking LightSwitch blog… So a big thank you to all that kept visiting my blog, posting me comments, tweets or mails, etc.  Time to repay your enthusiasm: it’s the blog, part… euh… Anyways, here we go!

The LightSwitch team released a new preview of our beloved technology yesterday, and it is miiiiiind-blowing!  Normally, when big stuff is about to hit us, I’m quite good at putting together the clues and posting a “Rumor has it…” post at least a couple of days beforehand.

This time though, except for my one tweet about the session that was given at //BUILD, where I noticed that the version they were showing had some slight differences between the preview 1 that I was exploring, the stars failed to predict the bomb that the team was about to drop on us.

So does this imply I don’t have a scoop for you, my dear reader? – O hell no, I do have some exiting news about this release that hasn’t been announced, documented, or even been mentioned in the official channels, or any other community channel.  The new born miracle is called “ServerApplicationContext”, and it’s so magical that I’m going to save it until the end of my post… :p

So what is this update all about?

It installs right over Visual Studio 2012

Which is awesome news. As you might remember, preview 1 was shipped in a vhd of a Win8 machine, which probably scared a lot of people off, myself included.  In my case, it was because I’m usually working on a laptop from work, and it would really be against company policy to decide to install a preview build of Win8 on this machine.  No one in my company knows that I actually installed it.


But anyways, this is awesome, because I can’t imagine any serious LightSwitch developer not grabbing this free 30-something-megs of goodness and start playing around with it.  More people means: more content from the community + more feedback to the team = happier life for all of us.

It requires you to make non-functional changes to your projects

Don’t make the mistake I did: if you want to play around with it, create a new project.  If you open an old project and want to use any of the new features:

  • You have to “add an HTML” client first.  This is when the conversion kicks in, and the new features become available to you.  However, when you do so:
  • Your project won’t be compatible with people who do not have this new preview installed.  But than again, what serious LightSwitch hacker is going to be able to resist all these goodies?

Thankfully, like in the past, the team managed to make this conversion a one-time-step where they take good care of your precious project if you stick to the official API’s only.

Damn, I’m basically screwed.  That’ll teach me.

Seriously though, just hold on to your seats for about a minute, and your project will be upgraded without you having to put in any effort.

Like deleting the common project.

Whoa momma, really? 
Yep, a LightSwitch application, that traditionally existed out of three projects (“client”, “common”, “‘server”) will now be reduced to only two projects.

Which in a way, was an obvious step that makes a lot of sense.  The common project contained code in c# (ok or VB.Net if you must), which isn’t really “common” between client and server if your client isn’t a CLR project itself.  The chances of new clients not being written in .NET are pretty high, I’m sorry to shock you if you were one of those people who were waiting for LightSwitch WinForms support, so this was an obvious move.

Anyways, the team will probably blog loads about the new “Entity Designer View”, I just want to point out that they still believe code that can be written only once, should be written only once.  They just decided that a common project was no longer the best way to accomplish this, so made this modification under the hood and focused more on the new clients.

Clients, plural, like the HTML mobile companion client

Good news, bad news.  The bad news is: from the looks of it the team reduced the number of HTML mobile companion apps from infinite to just one.  Not exactly sure why that is, but I trust their judgement, and this little loss gets paid back with tons of improved functionality in the HTML mobile companion app designers.  More extension points, in-IDE -debugging (thank god for that!!!), more custom methods, a new Listy control, and much much much more.

Clients, still plural, like the SharePoint apps

Seriously, this is HUGE.  I previously posted the link to the sample SharePoint app, but it seems to be broken. 😦

!!UPDATE!!: our LightSwitch goddess to the rescue: the real link is:

Either way, I consider this to be huge not only because it’ll allow the flock of LightSwitch developers to access new markets and do even more for their end-users, but also because it’ll bring an entire new audience (SharePoint developers) into our precious community.

Welcome guys, take a seat, first round is on me!

Again, I don’t doubt that the teams will blog about this in great detail over the next few weeks, and I don’t have anything interesting to say about it yet (I’m still pondering on how I’m going to hack this), so let’s move on to that scoop then…

Clients, still plural, like the ‘everything you can imagine’

Or at least: almost everything.

Since LightSwitch 2, an app that was previously using WCF RIA services turned into an app that exposed its data via the Open Data protocol.  This opened up a wide range of opportunities, and the community (Michael Washington in particular) went in overdrive coming up with new types of clients that used the REST api to interact with the data.

However, it still felt like you really were creating two apps, one LightSwitch app (or data service) and one additional (random) client.

Many of us have tried to find another way, some kind of mechanism that allows you, from your client code, to tap directly into the LightSwitch application model.  And those that tried really felt like swimming upstream, running into problems with connections remaining open, having to unload the LightSwitch project and manually alter the build process, …

Like always, the team was watching our moves, and decided to facilitate this play in the new preview release:

  • You can now add files to the server project and they will be built and shipped with the project without manual changes.  These files could be anything you would traditionally add to a server, like new WCF services or ASP.Net (web forms / MVC4) pages.
  • From the code-behind, you can actually access a ServerApplicationContext and interact with it (Current user, permissions, tables, queries, etc) like you interact with the ClientApplicationContext in the SL, HTML mobile companion, or SP clients!   Clean, simple, we’re gotten quite familiar with it, and they take care of all the internals for you.

This, is so incredibly huge, I would even dare to describe it as our own Server SDK!   Three potential use cases immediately come to my weird little mind:

  • Create full-blown (‘Desktop’) websites with LightSwitch!  Wow!  This has been requested by so many people.  Also, I bet you $10 bucks I can predict who will be the first to publish some really good community content about this…
  • Create a WCF service and expose it over a duplex binding so that you can implement a PubSub pattern.  No more polling, the server can actually publish to the clients when there is a new “Message” or “Alert” or …
  • Create a WCF service and actually call arbitrary business (non-cruddy) commands on the server, even long-running processes, without the need of the Command Table Pattern.


A very big thank you to the team for coming up with more and more LightSwitch goodness, I tip my hat to all of you!

Now, enough drooling, let’s hop into some code!

Keep rocking LS!

9 thoughts on “Rumor has it… LightSwitch HMTL Client preview 2 is released – omg omg omg with a ServerApplicationContext?!?

  1. Jan,

    Good to have you back!

    My organization supports enterprise application needs and currently see very little opportunity within the consumer space for this client. So while the Mobile support aspect of this client is cool, for me at least, it has a very small usage within the enterprise at large.

    That is not too say that this is a wasted effort, but if you look to the various blogs out there that speak to the needs of real Windows LOB Application development most still reside on the WPF/SL side of the fence. Quite a number I have read suggest that the MVC type applications are proving too complex to support and maintain and that they were looking to MS to advance LS in the WPF/SL space, not build something that targets the consumer market place.

    Personally I feel MS is missing a great opportunity to invest a little more into their SL client to make it a strong LOB candidate for the enterprise.


    • Hey again John 🙂

      Sometimes I think indeed MS isn’t investing in the enterprise-to-enterprise market enough too… However remember that this is still LS vs 2.0, I have a feeling that MS is really serious about this product. Hopefully time will prove me right 😀

      Keep rocking LS!

  2. Hey Jan,

    Great post, I think I’m going to have to go on a little LightSwitch safari today LOL
    I think our IT guys hate that I have admin rights on my laptop, Uh! Oh! there he goes again. LOL
    Glad your feeling better.


  3. Pingback: Beth Massi - Sharing the goodness

  4. Pingback: Beth Massi的中文博客

  5. Hi Jan,

    Do you think it is possible to solve the logout problem by ServerApplicationContext? I found two solution for logout, one is from Matt Evans,; the other is from Yann, the Lightswitch Command Extension. The first one is two complex and not very decent, the second one works, but I cannot set the other unnecessary command invisible. So I tried to use the command table pattern and your EME to move the singout work from client side to server side. However, I met some threading problem. I am new to both .net and lightswitch, it is quite difficult for me to digg that deep. Can you help me? Thanks.

  6. Pingback: #LightSwitch and #Syncfusion: simply beautiful applications. | Jan Van der Haegen's blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s