IT’S A GREAT TIME  to be an ASP.NET developer!
Whether you’ve been developing with ASP.NET for years, or are just getting started, now is a great
time to dig into ASP.NET MVC 3. ASP.NET MVC has been a lot of fun to work with from the
start, but with features like the new Razor view engine, integration with the NuGet package man-
agement system, deep integration with jQuery, and powerful extensibility options, ASP.NET MVC 3
is just a lot of fun to work with!
With this new release, things have changed enough that we’ve essentially rewritten the book, as
compared to the previous two releases. ASP.NET MVC team member Brad Wilson and noted ASP
.NET expert K. Scott Allen joined the author team, and we’ve had a blast creating a fresh new book.
Join us for a fun, informative tour of ASP.NET MVC 3!

 

  现在正是成为asp.net开发者的好时机!

  无论你是已经用asp.net做开发多年的专业人员, 抑或者只是刚刚入门的新手, 现在正是深入了解asp.net mvc3的时候。随着mvc3的各种新功能(Razor视图引擎、集成NuGet、整合jquery, 强大的扩展选项)的加入,asp.net mvc3将使你的工作更加高效。

   与前两个版本相比, mvc3的变化可谓巨大, 这使得我们基本上重写了这本书。Brad Wilson 和 K. Scott Allen也加入了本书的写作队伍, 这让我们更着实地完善这本书。让我们开始asp.net mvc3这次有趣且翔实的旅程吧。

 

目标读者:

 

This book is for web developers who are looking to add more complete testing to their web sites, 
and who are perhaps ready for “something different.”
In some places, we assume that you’re somewhat familiar with ASP.NET WebForms, at least periph-erally. There are a lot of ASP.NET WebForms developers out there who are interested in ASP.NET
MVC so there are a number of places in this book where we contrast the two technologies. Even if
you’re not already an ASP.NET developer, you might still fi nd these sections interesting for context,
as well as for your own edifi cation as ASP.NET MVC 3 may not be the web technology that you’re
looking for.

 

  这本书是为那些正在为网站寻找更好的测试方法以及那些准备尝试“其他方式”开发的 开发者准备的。我们假设你已经对asp.net webform开发有一定的了解, 由于有很多asp.net webform的开发者都对asp.net mvc感兴趣, 所以在本书的一些地方我们将对比两种技术来讲。即使你不是asp.net的开发者,通过阅读这本书相信也可以找到你所感兴趣的。

  值得一提的是, asp.net mvc并不是用来取代asp.net webform的。如果你一直在关注其他使用mvc应用模式的web框架(Ruby on Rails, Django)或者你只是对这些框加感到好奇, 那么这本书也是非常适合你的。

 

MVC allows for (buzzword alert!) a “greater separation of concerns” between components in your 
application. We’ll go into the ramifi cations of this later on, but if it had to be said in a quick sen-tence: ASP . NETMVC3isASP. NET Unplugged. ASP.NET MVC 3 is a tinkerer’s framework that
gives you very fi ne-grained control over your HTML and Javascript, as well as complete control
over the programmatic fl ow of your application.
There are no declarative server controls in MVC, which some people may like and others may
dislike. In the future, the MVC team may add declarative view controls to the mix, but these will
be far different from the components that ASP.NET Web Forms developers are used to, in which
a control encapsulates both the logic to render the view and the logic for responding to user input,
etc. Having all that encapsulated in a single control in the view would violate the “separation of
concerns” so central to this framework.

 

  mvc可以使你的应用程序中的组件更好地分离开来, 这一点我们会在后面详细述说, 但如果要用一句话来说明,那就是 “asp.net mvc3是asp.net的提炼(更纯朴更原生的一种存在)”。asp.net mvc3是一个熔补的框架, 它让你能够和控制程序流一样更好地控制html和javascript。

  mvc里面并没有定义服务器控件, 对于这一点, 人们抱有不同的想法。或许以后mvc团队会添加一些视图控件进来, 但这些与以往webform开发时使用的控件有着巨大的差异。在视图中加入控件(将所有逻辑[界面展示、响映用户输入等]封装在一起)会违背mvc框架的核心原则-"职责分离"。

  

The final analogy we can throw at you is that ASP.NET MVC 3 is more of a motorcycle, whereas 
ASP.NET Web Forms might be more like a minivan, complete with airbags and a DVD player in
case you have kids and you don’t want them to fi ght while you’re driving to the in-laws for Friday
dinner. Some people like motorcycles, some people like minivans. They’ll both get you where you
need to go, but one isn’t technically better than the other.

 

  最后我们可以再做个比喻:asp.net mvc3就像是一辆摩托车, 而webform则更像是一辆小型货车,这辆小货车配备有安全汽囊和DVD播放机, 假使车上有你的孩子, 并且你不想让他们打开这些当你正在赴周五晚餐的约。一些人喜欢摩托, 一些人喜欢小型货车, 他们同样都可以带你到达目的地,而他们的技术也是相等的。

 

本书的结构

  本书主要分为两大部分, 每一部分又包含若干章节. 本书的前半部分主要介绍了mvc模式以及asp.net mvc是如何实现该模式的.

  第一章 让你开始上手asp.net mvc3的开发。本章解释了什么是asp.net mvc有及mvc3和前两个版本有什么不同。接着, 在确保所需的软件都安装完成后, 你将着手创建一个mvc3 的应用程序。

  第二章  讲述了控制器和行为的基础. 你会从几个非常基础的"hello word"示例入门, 以实现从URL中收集数据并显示到屏幕上。

  第三章  讲述了怎样使用视图模板来为控制器行为提供展示。你将会学到asp.net mvc3包含的新的视图引擎-Razor

  第四章  本章将教给你的是, mvc模式的第三位成员-模型。你将学习到如何运用模型把数据从控制器传送给视图以及用数据库填充模型(运用EF4.1)。

  第五章  本章将深入讲述编辑场景, 解释在asp.net mvc3中表单是怎样被处理的。你将学到如何运用Html helper为你的视图层瘦身。

  第六章  讲述了如何使用attributes(特性)来为模型定义规则(如何显示、编辑及验证)

  第七章  教你如何保护你的asp.net mvc应用程序。指出当前面临的各种常见安全问题以及应该如何防范它们。你将学习如何运用asp.net membership和 authorization 功能来控制访问。

  第八章  在mvc中使用ajax,并特别提到了jquery和jquery, 你将学到如何运用asp.net mvc的ajax helper和jquery的验证系统来提升工作效率。

  第九章  本章将深入至路由系统来解释控制器行为是如何映射到URL的。

  第十章  本章将为你介绍NuGet包管理系统, 你将了解到它是如何与asp.net mvc3关联的, 如何安装它, 如何使用它来安装, 更新, 创建新的包。

  第十一章  解释了依赖注入。asp.net mvc3对它的支持及如何在你的应用中使用它。

  第十二章  为你介绍在asp.net 应用中的测试驱动的开发实践, 就如何编写有效的测试提供提示。

  第十三章  本章将进入asp.net mvc的扩展, 向你展示如何通过扩展框架以适应特殊的要求。

  第十四章  本章为进阶, 若尚未看过前面13章那么本章内容可能会打乱你的思绪。主要涵盖了复杂场景下的Razor, 脚手架, 路由, 模板和控制器。

 

 


 参考资料:Professional ASP.NET MVC3

  

  

posted on 2012-03-22 22:13  elycir  阅读(114)  评论(0编辑  收藏  举报