[This is from InfoQ - http://www.infoq.com/news/2012/02/SPA]

The ASP.NET MVC 4 beta includes an experimental project for developing “single page applications”. Known as ASP.NET SPA, this project type is based on a stack of open source libraries and the MVVM pattern made popular by WPF and Silverlight.

Browser-Side

At the bottom of the browser-side stack is the well-known jQuery library along with the Unobtrusive Ajax, jQuery UI, and jQuery Validation plugins.

Next in the stack is Upshot. It supposedly is a data access and caching library that builds on jQuery and Knockout. In the sample code, a knockout compatible view-model is automatically generated. Inside it are Upshot-based functions for handling communication with the service layer. It also includes code for driving the UI. (Like in XAML technologies, it appears that a SPA view-model can quickly become a dumping ground for all manner of code.)

MVVM style data binding is done using the Knockout framework. Like XAML based technologies, Knockout offers declarative data binding. Likewise, it works best when the data and view models are based on observables, which expose property change events. However you don’t have to explicitly raise the event, even for computed properties. Rather than setting a DataContext property on a control you call ko.applyBindings. This doesn’t prevent you from having child controls with a different data context, they simply need to use a “with” or “foreach” binding. The “with” binding is like binding a control’s DataContext to a property on the view model, while the latter effectively creates a items control.

At the top of the stack nav.js, a new library from Microsoft.

Server-Side

Server-side, the application frame is represented by a normal MVC page. The various views within the application are represented server-side by partial pages. In the sample, Knockout’s data binding is used to dynamically show and hide them.

Most of the server-side data access is handled by the abstract class DataController. This is a subclass of the ASP.NET Web API’s ApiController that offers basic methods for submitting a ChangeSetEntry from the client to the server. Developers who prefer using stored procedures or third-party ORMs can inherit from this directly; those leaning towards Entity Framework can use DbDataController. Visual Studio’s scaffolding support can automatically generate the latter with basic CRUD operations exposed.

转载于:https://www.cnblogs.com/brucejia/archive/2012/03/07/2383415.html

Single Page Applications in ASP.NET MVC 4相关推荐

  1. ASP.NET MVC – Nerdinner - notes

    The blog record any valuable point from the free book. <Professional ASP.NET MVC 1.0>! The blo ...

  2. 单页面 Web 应用(Single Page Application,SPA)的工作原理介绍

    原文地址 SPA 无处不在,但在网络开发人员中仍然是一个颇有争议的话题. 自 2003 年左右首次出现以来,单页 Web 应用程序已经取得了长足的进步.它们已成为现代 javascript 领域不可或 ...

  3. [转]Creating Unit Tests for ASP.NET MVC Applications (C#)

    本文转自:http://www.asp.net/mvc/tutorials/older-versions/unit-testing/creating-unit-tests-for-asp-net-mv ...

  4. 在ASP.NET MVC里对Web Page网页进行权限控制

    我们在ASP.NET MVC开发时,有时候还是得设计ASP.NET的Web Page网页(.aspx和.aspx.cs),来实现一些ASP.NET MVC无法实现的功能,如此篇<Visual S ...

  5. asp.net mvc webform和razor的page基类区别

    接触过asp.net mvc的都知道,在传统的webform的模式下,page页面的基类是这样声明的: <%@ Page Language="C#" MasterPageFi ...

  6. 使用asp.net mvc开发应用程序,页面中的page.IsPostback还有用处吗?

    本来我对asp.net mvc也研究了一段时间了,我也使用了asp.net mvc开发了两套应用程序,虽然都不是什么大的系统. 今天也想特别提出一个疑问,不知道是我不知道呢,还是本身很难实现在asp. ...

  7. Professional C# 6 and .NET Core 1.0 - Chapter 41 ASP.NET MVC

    What's In This Chapter? Features of ASP.NET MVC 6 Routing Creating Controllers Creating Views Valida ...

  8. ASP.NET MVC Framework体验(1):从一个简单实例开始

    概述 12月10日微软发布了ASP.NET 3.5扩展的预览版,在其中包括了ASP.NET MVC Framework.ASP.NET AJAX改进.ASP.NET动态数据支持.ASP.NET SIl ...

  9. 七天学会ASP.NET MVC(七)——创建单页应用

    目录 引言 最后一篇学什么 实验32-整理项目组织结构 关于实验32 实验33--创建单页应用--第一部分-安装 什么是Areas? 关于实验33 实验34--创建单页应用--第二部分-显示Emplo ...

最新文章

  1. class() 高级用法 -- lua
  2. jquery-easyui环境的搭建及测试
  3. TCSVT | 横看成岭侧成峰:交叉视角地理定位
  4. 【Java基础】使用带有标签的break,跳出多层循环
  5. Ubuntu18.04.3虚拟机安装步骤图文教程
  6. [摘]IIS上部署WCF的问题
  7. 百科园c语言题库13164,C语言题库-编程
  8. Java文件上传之断点续传解决方案
  9. 机器学习实战(一)xgboost实战
  10. 消费金融公司可开展哪些业务类型?
  11. 360与QQ大战观感
  12. Unity内置Shader解读9——Reflective/Bumped Diffuse
  13. 打开计算机无法关闭窗口,电脑中“打开或关闭Windows功能”窗口出错无法显示怎么解决...
  14. [图论]---[网络流]---最小点割数/最小点割集
  15. mysql配置文件参数详解_MySQL配置文件mysql.ini参数详解
  16. 电脑游戏业编年史之十二──叛逆
  17. Ardunio开发实例-被动红外(PIR)运动传感器使用
  18. Cannot interpret feed_dict key as Tensor: Tensor Tensor(“keras_learning_phase:0“, shape=(),
  19. 刚入职场需要用到的5个顶尖自学网
  20. 河南本科计算机科学与技术排名,河南计算机科学与技术专业大学排名

热门文章

  1. sqlserver数据库原理
  2. (转)linux dumpe2fs命令
  3. python - HTMLTestRunner 测试报告模板设置
  4. Redis之List类型操作
  5. 【工具】55种开源数据可视化工具简介
  6. 数据分析李小璐PG one出轨门自卫反击战
  7. 10个人有9个答错,另外1个只对一半:数据库的锁,到底锁的是什么?
  8. 面试官:你给我画一下秒杀系统的架构图!
  9. 5 月份最热的 GitHub 项目
  10. 程序员看《长安十二时辰》的正确姿势~!