书籍详情

ASP.NET MVC 4开发指南

ASP.NET MVC 4开发指南

作者:黄保翕(Will保哥)

出版社:清华大学出版社

出版时间:2013-07-01

ISBN:9787302324294

定价:¥59.00

购买这本书可以去
内容简介
  本书是由台湾知名博客站长与畅销书作者“Will保哥”所撰写的ASP.NET MVC 4开发指南,融入作者多年实务开发工作之精髓,从基础观念、技术讲解、开发实例、开发技巧到安装部署,都将以深入浅出的例子带领读者理解ASP.NET MVC框架的精妙之处,让网站生成工作更加安全、快速,也更容易维护!本书共分11章,第1章讲解通用的MVC特性,第2章讲述正确的开发观念,第3章以一个简单的例子带领读者快速上手ASP.NET MVC,第4~8章分别介绍了ASP.NET MVC最重要的核心观念与技术解析,其中包括路由与生命周期、模型、控制器、Razor视图引擎技术、本地技术等,第9章则以更高级的方式完成一套完整的电子商务网站开发实例,第10章分享笔者多年累积的各种开发技巧,第11章详述如何部署ASP.NET MVC到正式环境。本书适合有ASP.NET窗体开发经验的开发人员阅读,书中的演示能清楚带领读者快速了解ASP.NET MVC的开发细节与观念,相信能为读者带来全新的视野,轻松排查网站开发过程中衍生的各种难题。
作者简介
  黄保翕(Will保哥) 网络知名技术专家(个人博客The WillWill Web记载着Will在网络世界的学习心得与技术分享)。当前已经超过千篇文章。 台科大电子工程系毕业,现任多奇数位创意有限公司技术总监,自身专攻Web开发已经超过15年,早期专研LAMP相关技术,近几年全心转移技术领域至Microsoft.NET Platform与ASP.NET开发技术。曾担任 Visual Studio2010 上市发表会讲师、MSDN讲座讲师、TechDays Taiwan 2010/2011 讲师、TechEd China2011 讲师,出版著作有《ASP.NETMVC 2 开发实战》与《WindowsPhone开发实战》等。擅长各式Web排查方案、中大型网站架构规划、数据库系统设计、网站属性管理系统、网络系统与Web集成。微软最有价值专家(MVP),拥有MCTS、MCPD等国际认证。
目录
第1章  在学习ASP.NET MVC 之前··································· 3  1.1  何谓MVC······························· 3 1.1.1  何谓Model······················· 4 1.1.2  何谓View························· 5 1.1.3  何谓Controller················· 6 1.2  初探MVC架构······················ 7 1.2.1  彼此的关联性·················· 7 1.2.2  Controller与View 的关联性·························· 7 1.2.3  View与Model 的关联性·························· 8 1.2.4  Model与Controller 的关联性·························· 9 1.3  彼此的独立性························· 9 1.3.1  Controller与View之间  的独立性·························· 9 1.3.2  View与Model之间  的独立性·························· 9 1.3.3  Model与Controller之间  的独立性·························· 10 1.4  为什么要ASP.NET MVC······ 10 1.4.1  关注点分离与可维护性·· 10 1.4.2  开放特性与社群支持······ 10 1.4.3  开发工具与效率·············· 13 1.4.4  易于测试的架构·············· 13 1.4.5  易于分工的架构·············· 14 1.5  总结········································· 14 第2章  创建正确的开发观念·· 15  2.1  关注点分离····························· 15 2.2  以习惯替换配置····················· 16 2.2.1  Controller·························· 17 2.2.2  View·································· 18 2.2.3  Model································ 18 2.3  开发ASP.NET MVC项目时  的建议···································· 19 2.4  ASP.NET MVC常见问题······ 23 2.5  总结········································· 31 第3章  新手上路初体验············ 33 3.1  认识Visual Studio 2012 开发工具································ 33 3.2  介绍NuGet套件管理员········ 40 3.2.1  遭遇问题·························· 40 3.2.2  使用方法·························· 41 3.2.3  开启程序包管理器 控制台(Package Manager Console)··········· 43 3.2.4  启用NuGet套件还原······ 45 3.3  创建第一个ASP.NET MVC 专案········································ 47 3.3.1  利用ASP.NET MVC 4 项目模板创建项目·········· 48 3.3.2  创建数据模型·················· 57 3.3.3  创建控制器、动作与 检视·································· 59 3.3.4  测试当前创建好的留言板 网页·································· 62 3.3.5  查看数据库属性·············· 66 3.3.6  了解自动生成的程序 代码·································· 67 3.3.7  调整前台让用户留言 的版面······························ 85 3.4  学习MVC的注意事项·········· 91 3.4.1  了解不同的项目类型······ 91 3.4.2  初学者常犯的错误·········· 92 3.4.3  小心使用Request与Response 对象·································· 93 3.4.4  不要在检视中撰写过多 的程序逻辑···················· 93 3.5  总结····································· 93
第2篇  技术讲解篇      
第4章  Routing与ASP.NET MVC 生命周期························· 99 4.1  Routing——网址路由············ 99 4.1.1  比对通过浏览器传来的 HTTP要求······················· 99 4.1.2  响应适当的网址给 浏览器······························ 100 4.1.3  默认网址路由属性解说·· 101 4.2  HTTP要求的URL如何对应 网址路由································· 104 4.2.1  网址路由演示·················· 104 4.2.2  替网址路由加上路由值 的条件约束······················ 106 4.3  网址路由如何在ASP.NET MVC中生成网址·················· 107 4.4  ASP.NET MVC的运行生命 周期········································· 113 4.4.1  网址路由比对·················· 113 4.4.2  运行Controller与Action· 115 4.4.3  运行View并回传结果···· 120 4.5  总结········································· 120 第5章  Model相关技术············· 121 5.1  关于Model的责任················· 121 5.2  开发Model的基本观念········· 122 5.2.1  何谓ORM························ 122 5.2.2  数据库开发模式·············· 124 5.3  LocalDB介绍·························· 125 5.3.1  LocalDB 的运作方式······ 125 5.3.2  如何连接LocalDB实例·· 128 5.3.3  管理LocalDB自动实例·· 130 5.3.4  管理LocalDB具名实例·· 132 5.4  使用Code First创建数据 模型········································· 134 5.4.1  创建数据模型·················· 134 5.4.2  创建数据上下文类·········· 148 5.4.3  设计模型之间的关联性·· 149 5.4.4  启用延迟装入特性·········· 154 5.5  使用Code First数据库迁移·· 155 5.5.1  EF Code First如何记录 版本·································· 157 5.5.2  启用数据库迁移·············· 159 5.5.3  运行数据库迁移·············· 163 5.5.4  自定义数据库迁移规则·· 167 5.5.5  自动数据库迁移·············· 170 5.5.6  如何避免数据库被自动 创建或自动迁移·············· 171 5.6  使用ViewModel数据检视 模型········································ 172 5.7  扩充数据模型························· 172 5.7.1  定义数据模型的 Metadata···························· 173 5.7.2  自定义Metadata验证 属性·································· 178 5.7.3  ASP.NET MVC 3新增的 验证属性·························· 179 5.7.4  Entity Framework新增 的验证属性······················ 179 5.7.5  .NET 4.5新增的验证 属性·································· 180 5.8  总结········································· 180   第6章  Controller相关技术····· 181 6.1  关于Controller的责任··········· 181 6.2  Controller的类别与方法········ 181 6.3  Controller的运行过程············ 182 6.3.1  找不到Action时的 处理方式·························· 183 6.3.2  动作名称选定器·············· 185 6.4  动作方法选定器····················· 186 6.4.1  NonAction属性················ 186 6.4.2  HTTP动词限定属性······· 187 6.5  ActionResult解说··················· 188 6.5.1  ViewResult························ 189 6.5.2  PartialViewResult·············· 193 6.5.3  EmptyResult······················ 193 6.5.4  ContentResult···················· 193 6.5.5  FileResult·························· 194 6.5.6  JavaScriptResult················ 198 6.5.7  JsonResult························· 199 6.5.8  RedirectResult··················· 201 6.5.9  RedirectToRoute················ 202 6.5.10  HttpStatusCodeResult····· 204 6.5.11  HttpNotFoundResult······· 205 6.5.12  HttpUnauthorizedResult·· 205 6.6  ViewData、ViewBag与      TempData概述························ 206 6.6.1  ViewData··························· 206 6.6.2  ViewData.Model··············· 207 6.6.3  ViewBag···························· 209 6.6.4  TempData·························· 210 6.7  模型绑定································· 212 6.7.1  简单模型绑定·················· 212 6.7.2  使用FormCollection取得 窗体信息·························· 214 6.7.3  复杂模型绑定·················· 214 6.7.4  多个复杂模型绑定·········· 217 6.7.5  判断模型绑定的验证 结果·································· 220   6.7.6  模型绑定验证失败的错误 详细信息·························· 222 6.7.7  清空模型绑定状态·········· 223 6.7.8  使用Bind属性限制可被 更新的数据模型属性······ 224 6.7.9  使用UpdateModel与 TryUpdateModel··············· 226 6.8  动作过滤器····························· 228 6.8.1  授权过滤器属性·············· 230 6.8.2  动作过滤器属性·············· 234 6.8.3  结果过滤器属性·············· 238 6.8.4  例外过滤器属性·············· 239 6.8.5  自定义动作过滤器属性·· 242 6.9  总结········································· 244 第7章  View数据呈现相关 技术··································· 245 7.1  关于View的责任··················· 245 7.2  了解Razor语法······················ 245 7.2.1  Razor基本语法················ 246 7.2.2  Razor与HTML混合 输出·································· 247 7.2.3  Razor与HTML混合输出 陷阱与技巧······················ 251 7.2.4  Razor与ASPX语法比较····· 255 7.2.5  Razor的主版页面框架···· 258 7.2.6  @helper辅助方法············ 262 7.2.7  @functions自定义函数··· 266 7.2.8  @model引用参考资料 型别·································· 267 7.2.9  @using引用命名空间····· 267 7.3  View如何从Action取得 数据········································ 268 7.3.1  使用弱型别模型取得 数据·································· 269 7.3.2  使用强型别模型取得 数据·································· 271 7.4  HTML辅助方法····················· 271 7.4.1  使用HTML辅助方法输出 超链接····
猜您喜欢

读书导航