ASP.NET MVC Framework Unleashed

( 3 )

Overview

In this book, world-renowned ASP.NET expert and member of the Microsoft ASP.NET team Stephen Walther shows experienced developers how to use Microsoft’s new ASP.NET MVC Framework to build web applications that are more powerful, flexible, testable, manageable, scalable, and extensible.

Writing for professional programmers, Walther explains the crucial concepts that make the Model-View-Controller (MVC) development paradigm work so well and shows exactly how to apply them with the...

See more details below
Paperback
$41.69
BN.com price
(Save 24%)$54.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (11) from $12.51   
  • New (6) from $32.23   
  • Used (5) from $12.51   
ASP.NET MVC Framework Unleashed

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac

Want a NOOK? Explore Now

NOOK Book (eBook)
$25.49
BN.com price
(Save 42%)$43.99 List Price

Overview

In this book, world-renowned ASP.NET expert and member of the Microsoft ASP.NET team Stephen Walther shows experienced developers how to use Microsoft’s new ASP.NET MVC Framework to build web applications that are more powerful, flexible, testable, manageable, scalable, and extensible.

Writing for professional programmers, Walther explains the crucial concepts that make the Model-View-Controller (MVC) development paradigm work so well and shows exactly how to apply them with the ASP.NET MVC Framework. From controllers and actions to views and models, Walther demonstrates how to apply each ASP.NET MVC Framework feature in real-world projects.

In Part II, you’ll walk step-by-step through building a full-fledged ASP.NET MVC blog application that implements capabilities ranging from data access to validation. Through this case study, you’ll learn how to build ASP.NET MVC applications using test-driven development processes that enable rapid feedback, greater productivity, and better quality.

Throughout, Walther presents extensive code examples, reflecting his unsurpassed experience as an ASP.NET instructor, a leading commercial developer, and now as a member of Microsoft’s ASP.NET development team.

Understand how to:

  • Build enterprise-scale web applications far more rapidly and effectively
  • Develop web applications that are easier to maintain and extend over time
  • Gain unprecedented control over the appearance of your website or application
  • Expose intuitive URLs that are friendlier to search engines and users alike
  • Create ASP.NET MVC models that contain all your application’s business, validation, and data access logic
  • Make the most of HTML helpers, model binders, action filters, routing, and authentication
  • Efficiently deploy your ASP.NET MVC applications
  • Use the lightweight JQuery JavaScript library to easily find and manipulate HTML elements
  • Create ASP.NET MVC applications using unit test and mock object framework
Read More Show Less

Product Details

  • ISBN-13: 9780672329982
  • Publisher: Sams
  • Publication date: 7/29/2009
  • Series: Unleashed Series
  • Pages: 723
  • Sales rank: 1,470,064
  • Product dimensions: 6.90 (w) x 9.10 (h) x 1.50 (d)

Meet the Author

Stephen Walther has lived a year in Borneo, taught classes on metaphysics at Harvard and MIT, helped found two successful startups, and has run a training and consulting company. He currently is a Program Manager on the Microsoft ASP.NET team where he works on the Microsoft Ajax framework. He has spoken at numerous conferences including PDC, MIX, TechEd, ASP.NET Connections, and VSLive.
Read More Show Less

Table of Contents

Introduction 1

How This Book Is Organized 1

What You Should Know Before Reading This Book 2

What Software Do You Need? 2

Where Do You Download the Code Samples? 3

If You Like This Book 3

Part I Building ASP.NET MVC Applications

Chapter 1 An Introduction to ASP.NET MVC 7

A Story with a Moral 7

What Is Good Software? 8

Avoiding Code Smells 9

Software Design Principles 10

Software Design Patterns 11

Writing Unit Tests for Your Code 12

Test-Driven Development 13

Short-Term Pain, Long-Term Gain 14

What Is ASP.NET MVC? 14

ASP.NET MVC Is Part of the ASP.NET Framework 14

The Origins of MVC 15

The Architecture of an ASP.NET MVC Application 16

Understanding the Sample ASP.NET MVC Application 17

ASP.NET MVC Folder Conventions 19

Running the Sample ASP.NET MVC Application 19

Chapter 2 Building a Simple ASP.NET MVC Application 23

Starting with a Blank Slate 23

Creating the Database 25

Creating the Model 27

Creating the Controller 30

Creating the Views 37

Adding the Index View 38

Adding the Create View 42

Chapter 3 Understanding Controllers and Actions 47

Creating a Controller 47

Returning Action Results 51

Returning a View Result 52

Returning a Redirect Result 55

Returning a Content Result 57

Returning a JSON Result 59

Returning a File Result 63

Controlling How Actions Are Invoked 65

Using AcceptVerbs 65

Using ActionName 70

Using ActionMethodSelector 72

Handling Unknown Actions 76

Testing Controllers and Actions 78

Chapter 4 Understanding Views 83

Creating a View 83

Using View Data 87

Typed and Untyped Views 88

Creating Strongly Typed Views 94

Preventing JavaScript Injection Attacks 95

Using Alternative View Engines 97

Creating a Custom View Engine 99

Testing Views 105

Test the View Result 105

Test HTML Helpers 108

Test a Custom View Engine 114

Chapter 5 Understanding Models 119

Creating a Data Model 120

Creating a Data Model with the Microsoft Entity Framework 120

Listing Records 124

Getting a Single Record 126

Creating Records 127

Editing Records 128

Deleting Records 131

Using the Repository Pattern 132

Creating a Product Repository 133

Using the Dependency Injection Pattern 138

Creating a Generic Repository 139

Using the Generic Repository with the Entity Framework 141

Using the Generic Repository with LINQ to SQL 144

Extending the Generic Repository 147

Testing Data Access 149

Testing with a Mock Repository 150

Testing with a Fake Generic Repository 155

Chapter 6 Understanding HTML Helpers 159

Using the Standard HTML Helpers 160

Rendering Links 160

Rendering Image Links 161

Rendering Form Elements 162

Rendering a Form 166

Rendering a Drop-Down List 167

Encoding HTML Content 169

Using Antiforgery Tokens 169

Creating Custom HTML Helpers 173

Using the TagBuilder Class 176

Using the HtmlTextWriter Class 180

Creating a DataGrid Helper 183

Adding Sorting to the DataGrid Helper 190

Adding Paging to the DataGrid Helper 192

Testing Helpers 201

Chapter 7 Understanding Model Binders and Action Filters 207

Understanding Model Binders 207

Using the Default Model Binder 210

Binding to Complex Classes 212

Using the Bind Attribute 218

Using Bind with Classes 221

Using Prefixes When Binding 225

Using the Form Collection Model Binder 228

Using the HTTP Posted File Base Model Binder 231

Creating a Custom Model Binder 233

Understanding Action Filters 236

Creating a Log Action Filter 237

Chapter 8 Validating Form Data 241

Understanding Model State 241

Understanding the Validation Helpers 245

Styling Validation Error Messages 247

Prebinding and Postbinding Validation 248

Validating with a Service Layer 251

Validating with the IDataErrorInfo Interface 258

Testing Validation 264

Chapter 9 Understanding Routing 269

Using the Default Route 269

Debugging Routes 274

Creating Custom Routes 275

Creating Route Constraints 277

Using Regular Expression Constraints 278

Using the HttpMethod Constraint 280

Creating an Authenticated Constraint 280

Creating a NotEqual Constraint 283

Using Catch-All Routes 285

Testing Routes 288

Using the MvcFakes and RouteDebugger Assemblies 289

Testing If a URL Matches a Route 289

Testing Routes with Constraints 292

Chapter 10 Understanding View Master Pages and View User Controls 295

Understanding View Master Pages 295

Creating a View Master Page 295

Creating a View Content Page 300

Setting the Master Page from the Controller 302

Setting the Master Page Title 303

Nested Master Pages 306

Passing View Data to Master Pages 308

Understanding View User Controls 311

Passing View Data to User Controls 314

Using a View User Control as a Template 319

Chapter 11 Better Performance with Caching 325

Using the OutputCache Attribute 325

Don’t Cache Private Data 330

What Gets Cached? 331

Setting the Cache Location 333

Varying the Output Cache by Parameter 335

Varying the Output Cache 337

Removing Items from the Output Cache 341

Using Cache Profiles 343

Using the Cache API 344

Using the HttpCachePolicy Class 345

Using the Cache Class 347

Testing the Cache 353

Testing the OutputCache Attribute 353

Testing Adding Data to the Cache 355

Chapter 12 Authenticating Users 365

Creating Users and Roles 365

Using the Web Site Administration Tool 365

Using the Account Controller 367

Authorizing Users 368

Using the Authorize Attribute 368

Using the User Property 372

Configuring Membership 374

Configuring the Membership Database 375

Configuring Membership Settings 378

Using the Membership and Role Manager API 381

Using Windows Authentication 385

Configuring Windows Authentication 385

Authenticating Windows Users and Groups 386

Testing Authorization 390

Testing for the Authorize Attribute 390

Testing with the User Model Binder 393

Chapter 13 Deploying ASP.NET MVC Applications 401

Configuring IIS for ASP.NET MVC 401

Integrated Versus Classic Mode 402

Using ASP.NET MVC with Older Versions of IIS 403

Adding Extensions to the Route Table 403

Hosted Server 408

Creating a Wildcard Script Map 410

Mixing ASP.NET Web Forms and ASP.NET MVC 414

Modifying the Visual Studio Project File 415

Adding the Required Assemblies 415

Modifying the Web Configuration File 416

Modify the Global.asax File 422

Using Web Forms and MVC 424

Bin Deploying an ASP.NET MVC Application 424

Chapter 14 Working with Ajax 427

Using the Ajax Helpers 427

Debugging Ajax 428

Posting a Form Asynchronously 430

Displaying Progress 435

Updating Content After Posting 443

Performing Validation 447

Providing Downlevel Browser Support 452

Retrieving Content Asynchronously 454

Highlighting the Selected Link 459

Creating a Delete Link 462

Providing Downlevel Browser Support 468

Using the AcceptAjax Attribute 473

Chapter 15 Using jQuery 479

Overview of jQuery 479

Including the jQuery Library 480

jQuery and Visual Studio Intellisense 481

Using jQuery Selectors 482

Adding Event Handlers 487

Using jQuery Animations 489

jQuery and Ajax 491

Using jQuery Plug-Ins 498

Part II Walkthrough: Building the Unleashed Blog Application

Chapter 16 Overview of the Application 505

What Is Test-Driven Development? 505

Why Do Test-Driven Development? 506

The KISS and YAGNI Principles 507

Waterfall Versus Evolutionary Design 507

TDD Tests Are Not Unit Tests 508

Tests Flow from User Stories 508

Unit Testing Frameworks 509

Bibliography of Test-Driven Development 509

Chapter 17 Database Access 511

Creating the Unleashed Blog Project 511

Creating Our First Test 514

Creating New Blog Entries 520

Refactoring to Use the Repository Pattern 524

Creating a Fake Blog Repository 526

Creating an Entity Framework Repository 530

Creating the Database Objects 531

Creating the Entity Framework Data Model 532

Creating the Entity Framework Blog Repository 534

Using the Entity Framework Repository 537

Chapter 18 Creating the Routes 543

Creating the Controller Tests 543

Creating the Route Tests 553

Creating the Archive Routes 561

Trying Out the Archive Controller 564

Chapter 19 Adding Validation 567

Performing Validation in the Simplest Possible Way 567

Refactoring the Test Code 573

Validating the Length of a Property 576

A Web Browser Sanity Check 578

Refactoring to Use a Service Layer 581

Adding Business Rules 586

Chapter 20 Paging, Views, and Ajax 593

Adding Paging Support 593

Adding the Views 605

Adding Ajax Support 612

Chapter 21 Adding Comments 621

Implementing Comments 621

Adding Comments to the Database 633

Displaying Comments and Comment Counts 637

Part III Appendixes

Appendix A C# and VB.NET Language Features 647

Type Inference 647

Object Initializers 648

Anonymous Types 649

Nullable Types 651

Extension Methods 652

Generics 654

Lambda Expressions 655

LINQ 656

Appendix B Using a Unit Testing Framework 659

Using Visual Studio Unit Test 660

Understanding the Test Attributes 666

Using Assertions 669

Running the Tests 669

Limiting Visual Studio Test Results 671

Using NUnit 672

Creating an NUnit Unit Test Project 672

Creating a Test 674

Running Tests 676

Appendix C Using a Mock Object Framework 679

Understanding the Terminology 680

Installing Moq 680

Using Moq to Create a Class from an Interface 681

Returning Fake Values 690

Read More Show Less

Customer Reviews

Average Rating 4
( 3 )
Rating Distribution

5 Star

(1)

4 Star

(1)

3 Star

(1)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Posted May 10, 2010

    more from this reviewer

    Great Book

    Have you ever read the book "ASP .Net Unleashed" by the same author and did you like it ? If so, you will like

    this book by the same author. The author explains MVC by simple examples using understandable sources. The topics covered includes : Controller, Views, Models, HTML Helpers, Action Filters, Model Binders (Default, Custom), Action Routers, View Engine etc. Also the author introduces concepts like Unit Testing, Mocking, Good software design principles like DRY, SOLID, Repository design pattern etc. There is a couple of chapter explaining jQuery and AJAX. I also like the appendix which explains the new language features in Visual C++ which are fundamental for MVC framework, and the tools like mocking tool etc.

    After introducing the MVC concepts the author then moves to the second part where he is creating a Blog application from the scratch reinforcing the concepts we learnt in the first part.

    Overall I would recomment this book to everyone as it helps in understanding MVC clearly by using simple examples.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)