Single page application in ASP. net mvc 4

Source: Internet
Author: User
Tags jquery library

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.