The Model-View-Controller pattern—universally known as MVC—provides a stable, testable approach to web application development by separating the major functions—or concerns—of an application into independently defined roles.ASP.NET MVC in Action is a comprehensive guide to MVC-based development usin
ASP.NET MVC in Action
✍ Scribed by Jeffrey Palermo / Ben Scheirman / Jimmy Bogard
- Publisher
- Manning Publications
- Year
- 2009
- Tongue
- English
- Leaves
- 391
- Category
- Library
No coin nor oath required. For personal study only.
✦ Synopsis
内容简介 · · · · · ·
HIGHLIGHT An insider's perspective on the ASP.NET MVC framework, a highly-anticipated product that forms the basis for the next version of ASP.NET. DESCRIPTION The MVC pattern is widely accepted as the best practice for web development and is at the core of Rails, Zend Framework, and other modern web dev tools. Microsoft's new ASP.NET MVC Framework offers a fully-supported way for developers to implement MVC in ASP.NET. ASP.NET MVC in Action is a comprehensive guide to MVC-based development for Microsoft ASP.NET developers. It offers a clearly-written introduction both to the ASP.NET MVC Framework and to the MVC approach. The focus is on creating real, maintainable web applications, guiding readers from first-use through real-life scenarios. ASP.NET MVC in Action shows readers how to test each piece of an ASP.NET application using the principles of test-driven development. This book assumes that readers know how to build a standard ASP.NET application and presents most examples in C#. KEY POINTS Expert insider authors have been working with ASP.NET MVC since well before it was publicly announced Written for the working ASP.N ET developer Introduces test driven development and Agile processes - which may be unfamiliar to Microsoft developers MARKET INFORMATION Microsoft's ASP.NET is one of the most popular web development tools available, but it is no longer on the leading edge of innovation. Rails, Django, Seaside, and other frameworks have challenged Microsoft to improve ASP.NET. ASP.NET MVC represents the first major step in ASP.NET in many years, and will be embraced rapidly by ASP.NET developers.
作者简介 · · · · · ·
Jeffrey Palermo is a software management consultant and the CTO of Headspring Systems in Austin, TX. Jeffrey specializes in Agile coaching and helps companies double the productivity of software teams. Jeffrey is an MCSD.Net, Microsoft MVP, Certified ScrumMaster, Austin .Net User Group leader, AgileAustin board member, and an INETA speaker and Membership Mentor. He is an ASP.NET expert and has been working with Microsoft on the MVC framework since the initial prototype in March, 2007.
Ben Scheirman is a Principal Consultant with Sogeti in Houston, Texas. He studied computer science at the University of Houston and is a Certified ScrumMaster and Microsoft Certified Solution Developer. He enjoys speaking and blogging about agile development topics in .NET. Read his blog online at http://www.flux88.com.
Jimmy Bogard is a senior consultant with Headspring Systems in Austin, TX. His focus is using .NET technologies together with Agile methodologies. Back in 2005, he drank the Agile punch and hasn't looked at a waterfall the same since.
✦ Table of Contents
Front cover......Page 1
brief contents......Page 6
contents......Page 8
foreword......Page 14
preface......Page 16
acknowledgments......Page 19
Ben Scheirman......Page 20
Jimmy Bogard......Page 21
about this book......Page 22
Who should read this book?......Page 23
Roadmap......Page 24
Author Online......Page 26
about the authors......Page 27
About the technical reviewers......Page 28
about the cover illustration......Page 29
Getting started with the ASP.NET MVC Framework......Page 30
1.1 Picking apart the default application......Page 32
1.1.1 Creating the project......Page 33
1.1.2 Your first routes......Page 36
1.1.3 Running with the starter project......Page 38
1.2 Your first ASP.NET MVC controller from scratch......Page 43
1.3 Our first view......Page 45
1.4 Ensuring the application is maintainable......Page 47
1.5 Testing controller classes......Page 49
1.6 Summary......Page 51
The model in depth......Page 53
2.1 Understanding the basics of domain-driven design......Page 54
2.2.1 Key entities and value objects......Page 55
2.2.2 Aggregates......Page 56
2.2.3 Persistence for the domain model......Page 58
2.3.1 Presentation model responsibilities......Page 60
2.3.2 Projecting from the domain model......Page 62
2.4 Working with the model......Page 63
2.4.2 Crafting the controller action......Page 64
2.4.3 Test-driving the feature......Page 65
2.4.4 Finishing the view......Page 68
2.5 Summary......Page 71
The controller in depth......Page 73
3.1 The controller action......Page 74
3.2 Simple controllers do not need a view......Page 76
3.3.1 Testing the RedirectController......Page 79
3.3.2 Making dependencies explicit......Page 81
3.3.3 Using test doubles, such as stubs and mocks......Page 82
3.3.4 Elements of a good controller unit test......Page 84
3.4 Simple actions and views......Page 85
3.5 Working with form values......Page 86
3.6 Processing querystring parameters......Page 87
3.7 Binding more complex objects in action parameters......Page 88
3.8 Options for passing ViewData......Page 90
3.9 Filters......Page 91
3.10 Summary......Page 93
The view in depth......Page 94
4.1 How ASP.NET MVC views differ from Web Forms......Page 95
4.2 Folder structure and view basics......Page 96
4.3 Overview of view basics......Page 98
4.3.1 Examining the IViewEngine abstraction......Page 99
4.3.2 Understanding master pages in the ASP.NET MVC Framework......Page 100
4.3.3 Using ViewData to send objects to a view......Page 102
4.3.4 Partial views can help decompose a complex screen......Page 105
4.4.1 Rendering forms with view helpers and data binding......Page 108
4.4.2 Posting HTML forms back to the server......Page 113
4.4.3 Validation and error reporting......Page 114
4.4.4 Extending HtmlHelper......Page 117
4.5 Summary......Page 119
Routing......Page 120
5.1.1 What’s that curl command?......Page 121
5.1.2 Taking back control of the URL with routing......Page 123
5.2.1 Make simple, clean URLs......Page 124
5.2.3 Allow URL parameters to clash......Page 125
5.2.5 Avoid exposing database IDs wherever possible......Page 126
5.2.6 Consider adding unnecessary information......Page 127
5.3 Implementing routes in ASP.NET MVC......Page 128
5.3.1 URL schema for an online store......Page 131
5.3.3 Adding a custom dynamic route......Page 132
5.3.4 Catch-all routes......Page 134
5.4 Using the routing system to generate URLs......Page 136
5.5 Creating routes for Code Camp Server......Page 137
5.6 Testing route behavior......Page 140
5.7 Using routing with existing ASP.NET projects......Page 144
5.8 Summary......Page 146
Customizing and extending the ASP.NET MVC Framework......Page 148
6.1 Extending URL routing......Page 149
6.2 Creating your own ControllerFactory......Page 154
6.2.1 The ControllerFactory implementation......Page 155
6.2.2 Leveraging IoC for your controllers......Page 159
6.3 Extending the controller......Page 163
6.3.1 Creating a FormattableController......Page 164
6.3.2 Working with action filters......Page 167
6.4 Creating a custom view engine......Page 170
6.5.1 Creating custom T4 templates......Page 174
6.5.2 Adding a custom test project template to the new project wizard......Page 177
6.6 Summary......Page 179
Scaling the architecture for complex sites......Page 181
7.1 Taming large controller actions......Page 182
7.2.1 Using and creating view helpers......Page 185
7.2.2 Creating partials......Page 188
7.2.3 Creating components......Page 192
7.3 Using action filters to load common data......Page 194
7.4 Organizing controllers into areas......Page 196
7.4.2 Creating a view engine with support for areas......Page 197
7.4.3 Tying it all together......Page 200
7.5 Summary......Page 201
Leveraging existing ASP.NET features......Page 203
8.1.1 The TextBox......Page 204
8.1.2 Other common controls......Page 205
8.1.3 The GridView......Page 207
8.2.1 Caching......Page 208
8.2.2 Session state......Page 212
8.2.4 Request storage......Page 213
8.3 Tracing and debugging......Page 214
8.3.2 Health monitoring......Page 215
8.4.1 Leveraging ASP.NET personalization......Page 216
8.4.2 Leveraging ASP.NET localization......Page 217
8.5 Implementing ASP.NET site maps......Page 221
8.6 Summary......Page 223
AJAX in ASP.NET MVC......Page 224
9.1 Diving into AJAX with an example......Page 225
9.2 AJAX with ASP.NET Web Forms......Page 227
9.3 AJAX in ASP.NET MVC......Page 229
9.3.1 Hijaxing Code Camp Server......Page 230
9.3.2 AJAX with JSON......Page 236
9.3.3 Adding alternate view formats to the controller......Page 237
9.3.4 Consuming a JSON action from the view......Page 239
9.3.5 AJAX helpers......Page 242
9.4 Summary......Page 243
Hosting and deployment......Page 245
10.1 Deployment scenarios......Page 246
10.2 XCOPY deployment......Page 247
10.3 Deploying to IIS 7......Page 248
10.4 Deploying to IIS 6 and earlier......Page 252
10.4.1 Configuring routes to use the .aspx extension......Page 253
10.4.2 Configuring routes to use a custom extension......Page 254
10.4.3 Using wildcard mapping with selective disabling......Page 255
10.4.4 Using URL rewriting......Page 258
10.5.1 Employing continuous integration......Page 261
10.5.2 Enabling push-button XCOPY deployments......Page 262
10.5.3 Managing environment configurations......Page 263
10.6 Summary......Page 266
Exploring MonoRail and Ruby on Rails......Page 267
11.1.1 Feature overview......Page 268
11.1.2 ActiveRecord and Windsor......Page 277
11.2 Ruby on Rails......Page 284
11.2.1 Convention over configuration and “the Rails way”......Page 285
11.2.2 Active Record......Page 289
11.2.3 ActionPack......Page 293
11.3 Summary......Page 298
Best practices......Page 299
12.1.1 Layer Supertype......Page 300
12.1.2 Filters......Page 301
12.1.3 Smart binders......Page 303
12.1.4 Hardcoded strings......Page 308
12.1.5 Separated view models......Page 309
12.1.6 Validation......Page 310
12.2.1 Strongly typed views......Page 312
12.2.2 Fighting duplication......Page 313
12.2.3 Embracing expressions......Page 315
12.3.1 Testing routes......Page 318
12.3.2 Action naming......Page 321
12.4 Testing......Page 323
12.4.1 Controller unit tests......Page 324
12.4.2 Model binder unit tests......Page 327
12.4.3 Action filter unit tests......Page 330
12.4.4 Testing the last mile with UI tests......Page 332
12.5 Summary......Page 340
13.1 jQuery autocomplete text box......Page 341
13.2 Automatic client-side validation......Page 347
13.3 Data access with NHibernate......Page 354
13.3.1 Functional overview of reference implementation......Page 355
13.3.2 Application architecture overview......Page 356
13.3.3 Domain model—the application core......Page 357
13.3.4 NHibernate configuration—infrastructure of the application......Page 359
13.3.5 UI leverages domain model......Page 367
13.3.6 Pulling it together......Page 370
13.3.7 Wrapping up data access with NHibernate......Page 373
13.4.1 Installing and configuring Spark......Page 374
13.4.2 Simple Spark view example......Page 376
13.5 Summary......Page 380
A......Page 382
C......Page 383
F......Page 384
J......Page 385
M......Page 386
R......Page 387
S......Page 388
V......Page 389
Y......Page 390
Back cover......Page 391
📜 SIMILAR VOLUMES
<DIV><p>The Model-View-Controller pattern—universally known as MVC—provides a stable, testable approach to web application development by separating the major functions—or concerns—of an application into independently defined roles.</p> <p> ASP.NET MVC in Action is a comprehensive guide to MVC-b
this is a good introduction to ASP.NET MVC, but there is a lack of global schemes
ASP.NET MVC 4 in Action is a fast-paced tutorial designed to introduce ASP.NET MVC to .NET developers and show how to apply it effectively. All examples in this revised edition are based on ASP.NET MVC 4, so youll get full coverage of features such as the Razor view engine, Web Matrix helpers, and i
ASP.NET MVC 4 in Action is a fast-paced tutorial designed to introduce ASP.NET MVC to .NET developers and show how to apply it effectively. All examples in this revised edition are based on ASP.NET MVC 4, so you'll get full coverage of features such as the Razor view engine, Web Matrix helpers, and