What You Should Know Before Reading This Book
Where Do You Download the Code Samples?
Part I. Building ASP.NET MVC Applications
1. An Introduction to ASP.NET MVC
Writing Unit Tests for Your Code
Short-Term Pain, Long-Term Gain
ASP.NET MVC Is Part of the ASP.NET Framework
The Architecture of an ASP.NET MVC Application
Understanding the Sample ASP.NET MVC Application
ASP.NET MVC Folder Conventions
Running the Sample ASP.NET MVC Application
2. Building a Simple ASP.NET MVC Application
3. Understanding Controllers and Actions
Controlling How Actions Are Invoked
Testing Controllers and Actions
Preventing JavaScript Injection Attacks
Using Alternative View Engines
Creating a Data Model with the Microsoft Entity Framework
Using the Dependency Injection Pattern
Using the Generic Repository with the Entity Framework
Using the Generic Repository with LINQ to SQL
Extending the Generic Repository
Testing with a Mock Repository
Testing with a Fake Generic Repository
Using the Standard HTML Helpers
Using the HtmlTextWriter Class
Adding Sorting to the DataGrid Helper
Adding Paging to the DataGrid Helper
7. Understanding Model Binders and Action Filters
Using the Default Model Binder
Using the Form Collection Model Binder
Using the HTTP Posted File Base Model Binder
Creating a Custom Model Binder
Understanding the Validation Helpers
Styling Validation Error Messages
Prebinding and Postbinding Validation
Validating with a Service Layer
Validating with the IDataErrorInfo Interface
Using Regular Expression Constraints
Using the HttpMethod Constraint
Creating an Authenticated Constraint
Creating a NotEqual Constraint
Using the MvcFakes and RouteDebugger Assemblies
Testing If a URL Matches a Route
Testing Routes with Constraints
10. Understanding View Master Pages and View User Controls
Understanding View Master Pages
Setting the Master Page from the Controller
Passing View Data to Master Pages
Understanding View User Controls
Passing View Data to User Controls
Using a View User Control as a Template
11. Better Performance with Caching
Using the OutputCache Attribute
Varying the Output Cache by Parameter
Removing Items from the Output Cache
Using the HttpCachePolicy Class
Testing the OutputCache Attribute
Testing Adding Data to the Cache
Using the Web Site Administration Tool
Configuring the Membership Database
Configuring Membership Settings
Using the Membership and Role Manager API
Configuring Windows Authentication
Authenticating Windows Users and Groups
Testing for the Authorize Attribute
Testing with the User Model Binder
13. Deploying ASP.NET MVC Applications
Configuring IIS for ASP.NET MVC
Integrated Versus Classic Mode
Using ASP.NET MVC with Older Versions of IIS
Adding Extensions to the Route Table
Creating a Wildcard Script Map
Mixing ASP.NET Web Forms and ASP.NET MVC
Modifying the Visual Studio Project File
Adding the Required Assemblies
Modifying the Web Configuration File
Bin Deploying an ASP.NET MVC Application
Updating Content After Posting
Providing Downlevel Browser Support
Retrieving Content Asynchronously
Highlighting the Selected Link
Providing Downlevel Browser Support
Using the AcceptAjax Attribute
jQuery and Visual Studio Intellisense
Part II. Walkthrough: Building the Unleashed Blog Application
16. Overview of the Application
What Is Test-Driven Development?
Why Do Test-Driven Development?
Waterfall Versus Evolutionary Design
Bibliography of Test-Driven Development
Creating the Unleashed Blog Project
Refactoring to Use the Repository Pattern
Creating a Fake Blog Repository
Creating an Entity Framework Repository
Creating the Entity Framework Data Model
Creating the Entity Framework Blog Repository
Using the Entity Framework Repository
Trying Out the Archive Controller
Performing Validation in the Simplest Possible Way
Validating the Length of a Property
Refactoring to Use a Service Layer
Adding Comments to the Database
Displaying Comments and Comment Counts
A. C# and VB.NET Language Features
B. Using a Unit Testing Framework
Understanding the Test Attributes
Limiting Visual Studio Test Results
Creating an NUnit Unit Test Project
C. Using a Mock Object Framework
18.119.172.75