ASP. net mvc 4 beta contains an experimental project used to develop "single page Applications )". This project is also called ASP. NET spa. The project type is based on a set of open source libraries and popular mvvm modes on WPF and Silverlight.
Browser
The famous jquery library is located at the bottom of the browser Technical Group, along with unobtrusive Ajax, jquery UI, and jquery validation plug-ins.
The following technology is upshot. It is a data access and slow-down database built on jquery and knockout. In the exampleCodeYou will see that a view model compatible with Knockout is automatically generated. It is an internal Upshot-based function used to process communication with the service layer. It also contains the code used to drive the UI. (The spa view model is similar to the XAML technology, so it seems that this area will soon be filled with a variety of code .)
Mvvm-style data binding is completed using the knockout framework. Similar to the XAML-based technology, Knockout provides declarative data binding, which works perfectly when the data and view model changes the event's observables Based on the exposed attribute. In addition, you do not need to explicitly trigger events, even for computing attributes. The binding process is different from setting the datacontext attribute of the control. You need to call KO. applybindings. However, this does not prevent child controls from having different data contexts. In this case, you only need to simply bind them with "with" or "foreach. "With" binding is similar to binding the datacontext of the control to the attributes in the view model, while the "foreach" creates a project set control.
At the top of the technology group is Nav. JS, a new library launched by Microsoft.
Server
Server ApplicationsProgramThe framework is represented by common MVC pages, while various views in applications are represented by separated pages. In this example, the knockout data binding is used to dynamically display and hide these pages.
Most server-side data access is processed by the abstract class datacontroller. Datacontroller is a subclass of apicontroller in ASP. NET Web APIs. The latter provides the basic method for the client to submit changesetentry to the server. Developers who prefer stored procedures or third-party ORM can directly inherit this class, while developers who are familiar with Entity Framework can use dbdatacontroller. Visual Studio Scaffolding Support can automatically generate code with basic CRUD operations for the latter.
View Original English text:Http://www.infoq.com/news/2012/02/SPA
Infoq (http://www.infoq.com/cn/news/2012/02/SPA)