I just saw Stephen Walther deliver the session I came to TechEd to see, what’s new in the client-side scripting side for delivering Asp.Net content. I have been waiting to find out how the Asp.Net team hoped to integrate jQuery into Asp.Net for some time. Like a lot of you, I’ve come to the conclusion the only smart way to deliver data-heavy pages is via client-side scripting. The trick is to confine bandwidth only to readily consumed data as much as possible, as the large amount of mark-up associated with a normal ASP.NET page is often just bloat.
Up until recently, short of adopting a difficult roll-your-own approach, Asp.Net focussed methods for delivering client-side rendered content were pretty thin on the ground. But wait! It appears Microsoft have delivered a completely client-side API for delivering everything, right down to querying the database (through the JavaScript based Client Data Access library).
They claim it can consume ASMX delivered SOAP based web services, WCF services (via http only of course), ADO.Net Data Services (Which appears to be Entity Framework based “CRUD as a service” over several WCF delivered channels), MVC Framework controllers and (believe it or not) any JSON based end-point. Which means your Ruby-based JSON RESTful service can now be consumed, entirely on the client, by Microsoft’s new Ajax library. Impressive.
Other goodies include a clever way of delivering these new client-side libraries in a “one download fits all” kind of manner (This is the CDN apparently).
JS files (such as jQuery) are delivered from a single domain for potentially every web application developed under Asp.Net 4.0, with significant bandwidth optimization and as large a cache expiry as is humanly possible to have. The result: critical JS libraries are only ever downloaded once (in theory
). To prevent the potential download of every possibly referenced JS file, a clever script management library provides the “on demand” parallel loading of script dependencies from this common domain.
Substitute “on demand” with lazy-loading and you understand what I mean. Script files are only downloaded and cached by the user’s browser when and if a used dependency implies it. Every downloaded script registers itself as a jQuery plug-in, so everything plays nice with jQuery and, to be fair, the JavaScript aware IntelliSense makes it pretty easy to utilise as well.
The final goody mentioned is already available for download from the Asp.Net codeplex site. The Microsoft Ajax Minifier is a tool for stripping unnecessary characters from JavaScript files. Internally developed, Microsoft has been using this tool for years to optimise the delivery of their scripts. Once installed, it can be used in one of three modes:
- As a command line tool
- As an MSBuild task (very promising for those scripted release builds!)
- As a component to be rolled into your own application
This is positively, a cornucopia of new toys to play with. Next time I’ll rave about Dynamic data, or is that templating, no scaffolding, whatever, it’s cool anyway.
0 Responses to “Microsoft Ajax Bares new Client-Side Goodies”