Eric lippert - Amazon Web Services
Eric lippert - Amazon Web Services
Eric lippert - Amazon Web Services
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Pre-requisites<br />
• Visual Studio 2012 or Visual Studio Express 2012 for <strong>Web</strong><br />
• ASP.NET <strong>Web</strong> Tools 2012.2 update<br />
Let’s do this, shall we<br />
In Microsoft Visual Studio 2012, select ‘File’ > ‘New’ > ‘Project…’<br />
and then pick the ‘ASP.NET MVC 4 <strong>Web</strong> Application’ template<br />
from the <strong>Web</strong> section. Name the project something interesting<br />
and click ‘OK’. You will be presented by the following New MVC 4<br />
Project dialog:<br />
This includes:<br />
• App_Start – Start-up server side logic<br />
• Content – Usually contains images and css<br />
• Controllers – Page & API Controllers<br />
• Models – Model & View Model classes<br />
• Scripts – JavaScript files<br />
• Views – All the pages for the application<br />
In addition, we notice that HotTowel SPA provides an ‘App’<br />
folder which contains a collection of modules that<br />
encapsulates functionality and declares dependencies on<br />
other modules. Here is where all the magic happens. Your<br />
entire application basically lives in this domain.<br />
The dialog above may be familiar to those of you that are well<br />
versed in ASP.NET MVC, but after installing the ASP.NET <strong>Web</strong><br />
Tools 2012.2 update, you will notice a new template has been<br />
added to the list: ‘HotTowel Single Page Application’. Pick it and<br />
click ‘OK’.<br />
The SPA HotTowel template is also available on NuGet:<br />
Durandal is a cross-device, cross-platform client framework<br />
and designed to make SPAs easy to create.<br />
You can find out more by heading here:<br />
http://nuget.org/packages/HotTowel/<br />
Poking around the structure<br />
After Visual Studio did its thing, you will notice that the project<br />
has a similar structure than the good old stock standard ASP.NET<br />
MVC 4 project.<br />
The presentation logic for the views resides in the<br />
‘viewmodels’ folder. This is a common MVVM pattern.<br />
In the ‘views’ folder, you will see pure HTML files for your<br />
application. This is mainly driven by templating functionality<br />
of Knockout (a JavaScript library for MVVM).<br />
View by feature<br />
The SPA HotTowel template comes power-packed with the<br />
following functionality:<br />
• ASP.NET MVC<br />
• ASP.NET <strong>Web</strong> API<br />
• ASP.NET <strong>Web</strong> Optimization for bundling and minification<br />
• Breeze.js for rich data management<br />
• Durandal.js for view composition, app life cycle and<br />
navigation<br />
• Knockout.js for data bindings<br />
DNcmagazine www.dotnetcurry.com | 25