Build An App Using ASP.NET MVC 3, EF Code First, NuGet, and IISThe first session (which due to National Express East Anglia's incompetence I missed the start of) was Scott covering some of the features of MVC3/Razor and Code-First Entity Framework. This was probably the session I got the most out of all day, as I haven't done any MVC/EF in anger yet there was a lot of value here for me. Key points I took away were:
@ - starts a code block
@: - is the prefix for a string literal e.g. if you want to output some HTML inside a code block
There is detection for the @ symbol inside an email address that means it automatically renders a mailto: link
@@ - acts as an escape character
@helper - one of the biggest things for me, I've never seen this before. @helper allows you to write a helper method that acts like a method but with Razor syntax so you can call the helper to display a canned piece of HTML. Helpers can be declared in-line or in a partial class within the App_Code folder. Scott also mentioned that David Ebbo (@davidebbo) has a project on his website that allows you to write helpers that are compiled into an assembly. It's actually now on CodePlex at http://razorgenerator.codeplex.com/.
@model -By default the Model variable in a page is of the dynamic type, which means at design-time you don't get (much) Intellisense from it, however an @model declaration at the top of the page allows you to specify the exact type of Model, and you then get proper Intellisense support. If you create the View as a strongly-typed view and select the concrete type the View will support, it puts an @model declaration in for you.
_ViewStart.cshtml - Allows you to setup defaults for a set of views, including setting the _Layout.cshtml page. Someone asked whether you can have multiple _ViewStarts, Scott didn't know but was surprised when someone else said that you can. Gunnar Peipman's blog makes this clear - a _ViewStart is scoped to the folder that it is in.
_Layout.cshtml - The Razor equivalent of an ASP.NET Master page.
Scott also showed off a couple of tools:
Modernizr.js - allows you to detect which HTML5 and CSS3 features are supported on the browser instead of detecting these from the User-Agent string. Scott also showed off some HTML5 features in his demos, to which somebody asked if you could use those outside Razor. Scott's reply? "Yes, you can open your project and start typing the HTML5 tags" :-)
Glimpse - "FireBug for your server" is the best description of this tool. It shows you on the client what is happening on your server, how your server is configured. And I confess I'm pleased to see this is currently available for ASP.NET only, I'd assumed it was something other frameworks had had for a while but it seems not.
Dynamic Web UIs with Knockout.js
C#5 and Asynchronous Web Applications
After lunch Steve was on again, demoing some of the asynchronous bits that are coming in C#5. Steve talked about polling, long polling and sockets. The difference between these is as follows (I've probably got these wrong, if I have someone please tell me so I don't look a complete Muppet):
- polling - call a service at a regular interval e.g. every second, the service returns any changes made since the last call.
- long polling - call a service, the call doesn't return until the service has some data to return to the client, however long this takes.
- sockets - opens a channel between the caller and a service and the service then returns data to the client whenever it has any, keeping the channel open.
The last session of the day saw Scott back on the podium talking about developing for the cloud and Windows Azure. Scott has recently taken on management of the Azure team, although this was badly publicised as it sounded like Scott had moved away from ASP.NET and all the other things he was managing - this is not so, he's still in charge of ASP.NET and everything else, the Azure stuff is in addition to, not instead of. Scott talked about and showed off a lot of the infrastructure behind Azure, including fun facts like:
- the ratio of servers to staff in the data centres is 15 000:1
- the centres are constructed from containers
- the newer containers they are deploying don't have roofs which saves a lot of energy on cooling
- for every watt of energy that powers a server, they only use an additional 0.1 of a watt on ancillary usage such as heating/cooling etc
"Developers don't care about money, we just care about developing cool stuff."Employers, take note...
Scott demo'ed developing an ASP.NET application to be hosted in the cloud and showed the steps necessary to set this up. I was interested to hear that there is/will be a PowerShell commandlet for deploying solutions to your Azure setup.
Scott showed off some forthcoming technology on Azure, a Queuing service allowing you to de-couple parts of your business processes, which was interesting and made me wonder whether Microsoft might be thinking of putting some of the BizTalk infrastructure in the cloud. This would be a big win, I think, in terms of making BizTalk a more accessible technology and getting more take-up - we looked at BizTalk for a project a couple of years ago but the costs for setting up BizTalk on-site are currently prohibitive.
Scott presented a mini-case study on EasyJet - they host their applications in the cloud and then connect to them in airports using local WiFi, which saves them money on having to setup infrastructure in every airport they operate in.
Scott touched on the Azure AppFabric caching service, which I'm interested to know more about - I'm still fuzzy on the benefits. The throughput rate for the caching service is 4Tb/s - not too shabby. Scott also mentioned, almost, as my old German teacher would say, en passant, that Microsoft will shortly be rolling out a Content Delivery Network service on the Azure infrastructure, which is something I find really exciting. But maybe I'm just sad that way...
Thanks to Scott and Steve for presenting, Phil and Dave for organising it all, and Paul, Nathan, Johan and Dan for the conversation over dinner at TGIs!